Browse Source

Fixes preferences master password handling

pull/492/head
Michael Weimann 9 years ago
parent
commit
84217ca865
  1. 28
      app/view/preferences/PreferencesController.js

28
app/view/preferences/PreferencesController.js

@ -13,12 +13,28 @@ Ext.define('Rambox.view.preferences.PreferencesController', {
var values = me.getView().down('form').getForm().getFieldValues(); var values = me.getView().down('form').getForm().getFieldValues();
// Master Password // master password activated and only one of the fields "password" or "password confirmation" filled
if ( values.master_password && (Ext.isEmpty(values.master_password1) || Ext.isEmpty(values.master_password2)) ) return; if (values.master_password === true &&
if ( values.master_password && (values.master_password1 !== values.master_password2) ) return; (Ext.isEmpty(values.master_password1) === false && Ext.isEmpty(values.master_password2) === true ||
if ( values.master_password ) values.master_password = Rambox.util.MD5.encypt(values.master_password1); Ext.isEmpty(values.master_password1) === true && Ext.isEmpty(values.master_password2) === false)) return;
delete values.master_password1;
delete values.master_password2; // password and confirmation don't match
if (values.master_password === true && (values.master_password1 !== values.master_password2)) return;
// master password activated and changed
if (values.master_password === true &&
Ext.isEmpty(values.master_password1) === false &&
Ext.isEmpty(values.master_password2) === false) {
values.master_password = Rambox.util.MD5.encypt(values.master_password1);
delete values.master_password1;
delete values.master_password2;
}
// prevent overwriting password when unchanged
if (values.master_password === true) {
delete values.master_password;
}
// Proxy // Proxy
if ( values.proxy && (Ext.isEmpty(values.proxyHost) || Ext.isEmpty(values.proxyPort)) ) return; if ( values.proxy && (Ext.isEmpty(values.proxyHost) || Ext.isEmpty(values.proxyPort)) ) return;

Loading…
Cancel
Save