mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-10 17:13:38 +08:00
4cc2207513
Original unminified source code (dev folder - js, css, less) (fixes #6) Grunt build system Multiple identities correction (fixes #9) Compose html editor (fixes #12) New general settings - Loading Description New warning about default admin password Split general and login screen settings
65 lines
1.7 KiB
JavaScript
65 lines
1.7 KiB
JavaScript
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
|
|
/**
|
|
* @constructor
|
|
*/
|
|
function SettingsChangePasswordScreen()
|
|
{
|
|
this.changeProcess = ko.observable(false);
|
|
|
|
this.passwordUpdateError = ko.observable(false);
|
|
this.passwordUpdateSuccess = ko.observable(false);
|
|
|
|
this.currentPassword = ko.observable('');
|
|
this.newPassword = ko.observable('');
|
|
|
|
this.currentPassword.subscribe(function () {
|
|
this.passwordUpdateError(false);
|
|
this.passwordUpdateSuccess(false);
|
|
}, this);
|
|
|
|
this.newPassword.subscribe(function () {
|
|
this.passwordUpdateError(false);
|
|
this.passwordUpdateSuccess(false);
|
|
}, this);
|
|
|
|
this.saveNewPasswordCommand = Utils.createCommand(this, function () {
|
|
|
|
this.changeProcess(true);
|
|
|
|
this.passwordUpdateError(false);
|
|
this.passwordUpdateSuccess(false);
|
|
|
|
RL.remote().changePassword(this.onChangePasswordResponse, this.currentPassword(), this.newPassword());
|
|
|
|
}, function () {
|
|
return !this.changeProcess() && '' !== this.currentPassword() && '' !== this.newPassword();
|
|
});
|
|
|
|
this.onChangePasswordResponse = _.bind(this.onChangePasswordResponse, this);
|
|
}
|
|
|
|
Utils.addSettingsViewModel(SettingsChangePasswordScreen, 'SettingsChangePassword', 'SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME', 'change-password');
|
|
|
|
SettingsChangePasswordScreen.prototype.onHide = function ()
|
|
{
|
|
this.changeProcess(false);
|
|
this.currentPassword('');
|
|
this.newPassword('');
|
|
};
|
|
|
|
SettingsChangePasswordScreen.prototype.onChangePasswordResponse = function (sResult, oData)
|
|
{
|
|
this.changeProcess(false);
|
|
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
|
{
|
|
this.currentPassword('');
|
|
this.newPassword('');
|
|
|
|
this.passwordUpdateSuccess(true);
|
|
}
|
|
else
|
|
{
|
|
this.passwordUpdateError(true);
|
|
}
|
|
};
|