|
|
@ -243,39 +243,57 @@ Ext.define('Rambox.view.main.MainController', { |
|
|
|
,lockRambox: function(btn) { |
|
|
|
,lockRambox: function(btn) { |
|
|
|
var me = this; |
|
|
|
var me = this; |
|
|
|
|
|
|
|
|
|
|
|
var msgbox = Ext.Msg.prompt('Lock Rambox', 'Enter a temporal password to unlock it later', function(btnId, text) { |
|
|
|
if ( ipc.sendSync('getConfig').master_password ) { |
|
|
|
if ( btnId === 'ok' ) { |
|
|
|
Ext.Msg.confirm('Lock Rambox', 'Do you want to use the Master Password as your temporal password?', function(btnId) { |
|
|
|
var msgbox2 = Ext.Msg.prompt('Lock Rambox', 'Repeat the temporal password', function(btnId, text2) { |
|
|
|
if ( btnId === 'yes' ) { |
|
|
|
if ( btnId === 'ok' ) { |
|
|
|
setLock(ipc.sendSync('getConfig').master_password); |
|
|
|
if ( text !== text2 ) { |
|
|
|
} else { |
|
|
|
Ext.Msg.show({ |
|
|
|
showTempPass(); |
|
|
|
title: 'Warning' |
|
|
|
} |
|
|
|
,message: 'Passwords are not the same. Please try again...' |
|
|
|
}); |
|
|
|
,icon: Ext.Msg.WARNING |
|
|
|
} else { |
|
|
|
,buttons: Ext.Msg.OK |
|
|
|
showTempPass(); |
|
|
|
,fn: me.lockRambox |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return false; |
|
|
|
function showTempPass() { |
|
|
|
|
|
|
|
var msgbox = Ext.Msg.prompt('Lock Rambox', 'Enter a temporal password to unlock it later', function(btnId, text) { |
|
|
|
|
|
|
|
if ( btnId === 'ok' ) { |
|
|
|
|
|
|
|
var msgbox2 = Ext.Msg.prompt('Lock Rambox', 'Repeat the temporal password', function(btnId, text2) { |
|
|
|
|
|
|
|
if ( btnId === 'ok' ) { |
|
|
|
|
|
|
|
if ( text !== text2 ) { |
|
|
|
|
|
|
|
Ext.Msg.show({ |
|
|
|
|
|
|
|
title: 'Warning' |
|
|
|
|
|
|
|
,message: 'Passwords are not the same. Please try again...' |
|
|
|
|
|
|
|
,icon: Ext.Msg.WARNING |
|
|
|
|
|
|
|
,buttons: Ext.Msg.OK |
|
|
|
|
|
|
|
,fn: me.lockRambox |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setLock(Rambox.util.MD5.encypt(text)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
msgbox2.textField.inputEl.dom.type = 'password'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
msgbox.textField.inputEl.dom.type = 'password'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
console.info('Lock Rambox:', 'Enabled'); |
|
|
|
function setLock(text) { |
|
|
|
|
|
|
|
console.info('Lock Rambox:', 'Enabled'); |
|
|
|
|
|
|
|
|
|
|
|
// Save encrypted password in localStorage to show locked when app is reopen
|
|
|
|
// Save encrypted password in localStorage to show locked when app is reopen
|
|
|
|
localStorage.setItem('locked', Rambox.util.MD5.encypt(text)); |
|
|
|
localStorage.setItem('locked', text); |
|
|
|
|
|
|
|
|
|
|
|
// Google Analytics Event
|
|
|
|
// Google Analytics Event
|
|
|
|
ga_storage._trackEvent('Usability', 'locked'); |
|
|
|
ga_storage._trackEvent('Usability', 'locked'); |
|
|
|
|
|
|
|
|
|
|
|
me.lookupReference('disturbBtn').setPressed(true); |
|
|
|
me.lookupReference('disturbBtn').setPressed(true); |
|
|
|
me.dontDisturb(me.lookupReference('disturbBtn'), false, true); |
|
|
|
me.dontDisturb(me.lookupReference('disturbBtn'), false, true); |
|
|
|
|
|
|
|
|
|
|
|
me.showLockWindow(); |
|
|
|
me.showLockWindow(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
msgbox2.textField.inputEl.dom.type = 'password'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
msgbox.textField.inputEl.dom.type = 'password'; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
,showLockWindow: function() { |
|
|
|
,showLockWindow: function() { |
|
|
|