Browse Source

Enter password twice for lock

Fixes #136
pull/223/head
Ramiro Saenz 9 years ago
parent
commit
3d77895119
  1. 123
      app/view/main/MainController.js

123
app/view/main/MainController.js

@ -756,65 +756,80 @@ Ext.define('Rambox.view.main.MainController', {
var msgbox = Ext.Msg.prompt('Lock Rambox', 'Enter a temporal password to unlock it later', function(btnId, text) { var msgbox = Ext.Msg.prompt('Lock Rambox', 'Enter a temporal password to unlock it later', function(btnId, text) {
if ( btnId === 'ok' ) { if ( btnId === 'ok' ) {
// Google Analytics Event var msgbox2 = Ext.Msg.prompt('Lock Rambox', 'Repeat the temporal password', function(btnId, text2) {
ga_storage._trackEvent('Usability', 'locked'); if ( btnId === 'ok' ) {
if ( text !== text2 ) {
me.lookupReference('disturbBtn').setPressed(true); Ext.Msg.show({
me.dontDisturb(me.lookupReference('disturbBtn'), false, true); title: 'Warning'
var winLock = Ext.create('Ext.window.Window', { ,message: 'Passwords are not the same. Please try again...'
width: '100%' ,icon: Ext.Msg.WARNING
,height: '100%' ,buttons: Ext.Msg.OK
,closable: false ,fn: me.lockRambox
,minimizable: false });
,maximizable: false return false;
,draggable: false }
,onEsc: Ext.emptyFn // Google Analytics Event
,layout: 'center' ga_storage._trackEvent('Usability', 'locked');
,bodyStyle: 'background-color:#2e658e;'
,items: [ me.lookupReference('disturbBtn').setPressed(true);
{ me.dontDisturb(me.lookupReference('disturbBtn'), false, true);
xtype: 'container' var winLock = Ext.create('Ext.window.Window', {
,layout: 'vbox' width: '100%'
,height: '100%'
,closable: false
,minimizable: false
,maximizable: false
,draggable: false
,onEsc: Ext.emptyFn
,layout: 'center'
,bodyStyle: 'background-color:#2e658e;'
,items: [ ,items: [
{ {
xtype: 'image' xtype: 'container'
,src: 'resources/Icon.png' ,layout: 'vbox'
,width: 256 ,items: [
,height: 256 {
} xtype: 'image'
,{ ,src: 'resources/Icon.png'
xtype: 'component' ,width: 256
,autoEl: { ,height: 256
tag: 'h1'
,html: 'Rambox is locked'
,style: 'text-align:center;width:256px;'
}
}
,{
xtype: 'textfield'
,inputType: 'password'
,width: 256
}
,{
xtype: 'button'
,text: 'UNLOCK'
,glyph: 'xf13e@FontAwesome'
,width: 256
,scale: 'large'
,handler: function() {
if ( text === winLock.down('textfield').getValue() ) {
winLock.close();
me.lookupReference('disturbBtn').setPressed(false);
me.dontDisturb(me.lookupReference('disturbBtn'));
} else {
winLock.down('textfield').markInvalid('Unlock password is invalid');
} }
} ,{
xtype: 'component'
,autoEl: {
tag: 'h1'
,html: 'Rambox is locked'
,style: 'text-align:center;width:256px;'
}
}
,{
xtype: 'textfield'
,inputType: 'password'
,width: 256
}
,{
xtype: 'button'
,text: 'UNLOCK'
,glyph: 'xf13e@FontAwesome'
,width: 256
,scale: 'large'
,handler: function() {
if ( text === winLock.down('textfield').getValue() ) {
winLock.close();
me.lookupReference('disturbBtn').setPressed(false);
me.dontDisturb(me.lookupReference('disturbBtn'));
} else {
winLock.down('textfield').markInvalid('Unlock password is invalid');
}
}
}
]
} }
] ]
} }).show();
] }
}).show(); });
msgbox2.textField.inputEl.dom.type = 'password';
} }
}); });
msgbox.textField.inputEl.dom.type = 'password'; msgbox.textField.inputEl.dom.type = 'password';

Loading…
Cancel
Save