Added new admin login text input (Admin/Security)

Themes now work for admin panel too.
This commit is contained in:
RainLoop Team 2014-10-18 19:06:31 +04:00
parent 8cf8b94d39
commit adb92ba3ef
7 changed files with 162 additions and 82 deletions

View file

@ -27,6 +27,7 @@
this.capaTwoFactorAuth = ko.observable(Settings.capa(Enums.Capa.TwoFactor));
this.adminLogin = ko.observable(Settings.settingsGet('AdminLogin'));
this.adminLoginError = ko.observable(false);
this.adminPassword = ko.observable('');
this.adminPasswordNew = ko.observable('');
this.adminPasswordNew2 = ko.observable('');
@ -40,6 +41,10 @@
this.adminPasswordUpdateSuccess(false);
}, this);
this.adminLogin.subscribe(function () {
this.adminLoginError(false);
}, this);
this.adminPasswordNew.subscribe(function () {
this.adminPasswordUpdateError(false);
this.adminPasswordUpdateSuccess(false);
@ -54,6 +59,12 @@
this.saveNewAdminPasswordCommand = Utils.createCommand(this, function () {
if ('' === Utils.trim(this.adminLogin()))
{
this.adminLoginError(true);
return false;
}
if (this.adminPasswordNew() !== this.adminPasswordNew2())
{
this.adminPasswordNewError(true);
@ -64,12 +75,13 @@
this.adminPasswordUpdateSuccess(false);
Remote.saveNewAdminPassword(this.onNewAdminPasswordResponse, {
'Login': this.adminLogin(),
'Password': this.adminPassword(),
'NewPassword': this.adminPasswordNew()
});
}, function () {
return '' !== this.adminPassword() && '' !== this.adminPasswordNew() && '' !== this.adminPasswordNew2();
return '' !== Utils.trim(this.adminLogin()) && '' !== this.adminPassword();
});
this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this);