mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-09 14:38:27 +03:00
Uploading and preparing the repository to the dev version.
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
This commit is contained in:
parent
afad45137e
commit
4cc2207513
846 changed files with 99453 additions and 2123 deletions
86
dev/ViewModels/AdminLoginViewModel.js
Normal file
86
dev/ViewModels/AdminLoginViewModel.js
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractViewModel
|
||||
*/
|
||||
function AdminLoginViewModel()
|
||||
{
|
||||
KnoinAbstractViewModel.call(this, 'Right', 'AdminLogin');
|
||||
|
||||
this.login = ko.observable('');
|
||||
this.password = ko.observable('');
|
||||
|
||||
this.loginError = ko.observable(false);
|
||||
this.passwordError = ko.observable(false);
|
||||
|
||||
this.loginFocus = ko.observable(false);
|
||||
|
||||
this.login.subscribe(function () {
|
||||
this.loginError(false);
|
||||
}, this);
|
||||
|
||||
this.password.subscribe(function () {
|
||||
this.passwordError(false);
|
||||
}, this);
|
||||
|
||||
this.submitRequest = ko.observable(false);
|
||||
this.submitError = ko.observable('');
|
||||
|
||||
this.submitCommand = Utils.createCommand(this, function () {
|
||||
|
||||
this.loginError('' === Utils.trim(this.login()));
|
||||
this.passwordError('' === Utils.trim(this.password()));
|
||||
|
||||
if (this.loginError() || this.passwordError())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this.submitRequest(true);
|
||||
|
||||
RL.remote().adminLogin(_.bind(function (sResult, oData) {
|
||||
|
||||
if (Enums.StorageResultType.Success === sResult && oData&& 'AdminLogin' === oData.Action)
|
||||
{
|
||||
if (oData.Result)
|
||||
{
|
||||
RL.loginAndLogoutReload();
|
||||
}
|
||||
else if (oData.ErrorCode)
|
||||
{
|
||||
this.submitRequest(false);
|
||||
this.submitError(Utils.getNotification(oData.ErrorCode));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.submitRequest(false);
|
||||
this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
|
||||
}
|
||||
|
||||
}, this), this.login(), this.password());
|
||||
|
||||
return true;
|
||||
|
||||
}, function () {
|
||||
return !this.submitRequest();
|
||||
});
|
||||
}
|
||||
|
||||
Utils.extendAsViewModel('AdminLoginViewModel', AdminLoginViewModel);
|
||||
|
||||
AdminLoginViewModel.prototype.onShow = function ()
|
||||
{
|
||||
kn.routeOff();
|
||||
|
||||
_.delay(_.bind(function () {
|
||||
this.loginFocus(true);
|
||||
}, this), 100);
|
||||
|
||||
};
|
||||
|
||||
AdminLoginViewModel.prototype.onHide = function ()
|
||||
{
|
||||
this.loginFocus(false);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue