mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 05:59:21 +03:00
Code refactoring
Flow first look
This commit is contained in:
parent
2f841524cb
commit
e6e0b02849
71 changed files with 2092 additions and 1836 deletions
|
|
@ -2,7 +2,7 @@
|
|||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {createCommand, trim, boolToAjax} from 'Common/Utils';
|
||||
import {trim, boolToAjax} from 'Common/Utils';
|
||||
import {phpInfo} from 'Common/Links';
|
||||
import {StorageResultType, Magics} from 'Common/Enums';
|
||||
|
||||
|
|
@ -13,6 +13,8 @@ import CapaAdminStore from 'Stores/Admin/Capa';
|
|||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
import {command} from 'Knoin/Knoin';
|
||||
|
||||
class SecurityAdminSettings
|
||||
{
|
||||
constructor() {
|
||||
|
|
@ -77,35 +79,36 @@ class SecurityAdminSettings
|
|||
this.adminPasswordNewError(false);
|
||||
});
|
||||
|
||||
this.saveNewAdminPasswordCommand = createCommand(() => {
|
||||
|
||||
if ('' === trim(this.adminLogin()))
|
||||
{
|
||||
this.adminLoginError(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.adminPasswordNew() !== this.adminPasswordNew2())
|
||||
{
|
||||
this.adminPasswordNewError(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
this.adminPasswordUpdateError(false);
|
||||
this.adminPasswordUpdateSuccess(false);
|
||||
|
||||
Remote.saveNewAdminPassword(this.onNewAdminPasswordResponse, {
|
||||
'Login': this.adminLogin(),
|
||||
'Password': this.adminPassword(),
|
||||
'NewPassword': this.adminPasswordNew()
|
||||
});
|
||||
|
||||
return true;
|
||||
}, () => '' !== trim(this.adminLogin()) && '' !== this.adminPassword());
|
||||
|
||||
this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this);
|
||||
}
|
||||
|
||||
@command((self) => '' !== trim(self.adminLogin()) && '' !== self.adminPassword())
|
||||
saveNewAdminPasswordCommand() {
|
||||
|
||||
if ('' === trim(this.adminLogin()))
|
||||
{
|
||||
this.adminLoginError(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.adminPasswordNew() !== this.adminPasswordNew2())
|
||||
{
|
||||
this.adminPasswordNewError(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
this.adminPasswordUpdateError(false);
|
||||
this.adminPasswordUpdateSuccess(false);
|
||||
|
||||
Remote.saveNewAdminPassword(this.onNewAdminPasswordResponse, {
|
||||
'Login': this.adminLogin(),
|
||||
'Password': this.adminPassword(),
|
||||
'NewPassword': this.adminPasswordNew()
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
showTwoFactorDropper() {
|
||||
this.twoFactorDropperUser('');
|
||||
this.isTwoFactorDropperShown(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue