mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +03:00
Enhancement to Two Factor Auth (Closes #131)
This commit is contained in:
parent
e211899c7b
commit
365a79049e
30 changed files with 359 additions and 208 deletions
|
|
@ -7,6 +7,7 @@ function SettingsSecurity()
|
|||
{
|
||||
this.processing = ko.observable(false);
|
||||
this.clearing = ko.observable(false);
|
||||
this.secreting = ko.observable(false);
|
||||
|
||||
this.viewUser = ko.observable('');
|
||||
this.viewEnable = ko.observable(false);
|
||||
|
|
@ -29,10 +30,24 @@ function SettingsSecurity()
|
|||
}, this);
|
||||
|
||||
this.onResult = _.bind(this.onResult, this);
|
||||
this.onSecretResult = _.bind(this.onSecretResult, this);
|
||||
}
|
||||
|
||||
Utils.addSettingsViewModel(SettingsSecurity, 'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
|
||||
|
||||
SettingsSecurity.prototype.showSecret = function ()
|
||||
{
|
||||
this.secreting(true);
|
||||
RL.remote().showTwoFactorSecret(this.onSecretResult);
|
||||
};
|
||||
|
||||
SettingsSecurity.prototype.hideSecret = function ()
|
||||
{
|
||||
this.viewSecret('');
|
||||
this.viewBackupCodes('');
|
||||
this.viewUrl('');
|
||||
};
|
||||
|
||||
SettingsSecurity.prototype.createTwoFactor = function ()
|
||||
{
|
||||
this.processing(true);
|
||||
|
|
@ -113,6 +128,22 @@ SettingsSecurity.prototype.onResult = function (sResult, oData)
|
|||
}
|
||||
};
|
||||
|
||||
SettingsSecurity.prototype.onSecretResult = function (sResult, oData)
|
||||
{
|
||||
this.secreting(false);
|
||||
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
this.viewSecret(Utils.pString(oData.Result.Secret));
|
||||
this.viewUrl(Utils.pString(oData.Result.Url));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.viewSecret('');
|
||||
this.viewUrl('');
|
||||
}
|
||||
};
|
||||
|
||||
SettingsSecurity.prototype.onBuild = function ()
|
||||
{
|
||||
this.processing(true);
|
||||
|
|
|
|||
|
|
@ -72,6 +72,14 @@ WebMailAjaxRemoteStorage.prototype.clearTwoFactor = function (fCallback)
|
|||
this.defaultRequest(fCallback, 'ClearTwoFactorInfo');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
WebMailAjaxRemoteStorage.prototype.showTwoFactorSecret = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'ShowTwoFactorSecret');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sCode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue