Enhancement to Two Factor Auth (Closes #131)

This commit is contained in:
RainLoop Team 2014-04-15 01:58:27 +04:00
parent e211899c7b
commit 365a79049e
30 changed files with 359 additions and 208 deletions

View file

@ -7,6 +7,7 @@ function SettingsSecurity()
{ {
this.processing = ko.observable(false); this.processing = ko.observable(false);
this.clearing = ko.observable(false); this.clearing = ko.observable(false);
this.secreting = ko.observable(false);
this.viewUser = ko.observable(''); this.viewUser = ko.observable('');
this.viewEnable = ko.observable(false); this.viewEnable = ko.observable(false);
@ -29,10 +30,24 @@ function SettingsSecurity()
}, this); }, this);
this.onResult = _.bind(this.onResult, this); this.onResult = _.bind(this.onResult, this);
this.onSecretResult = _.bind(this.onSecretResult, this);
} }
Utils.addSettingsViewModel(SettingsSecurity, 'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security'); 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 () SettingsSecurity.prototype.createTwoFactor = function ()
{ {
this.processing(true); 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 () SettingsSecurity.prototype.onBuild = function ()
{ {
this.processing(true); this.processing(true);

View file

@ -72,6 +72,14 @@ WebMailAjaxRemoteStorage.prototype.clearTwoFactor = function (fCallback)
this.defaultRequest(fCallback, 'ClearTwoFactorInfo'); this.defaultRequest(fCallback, 'ClearTwoFactorInfo');
}; };
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.showTwoFactorSecret = function (fCallback)
{
this.defaultRequest(fCallback, 'ShowTwoFactorSecret');
};
/** /**
* @param {?Function} fCallback * @param {?Function} fCallback
* @param {string} sCode * @param {string} sCode

View file

@ -4721,6 +4721,28 @@ class Actions
$this->getTwoFactorInfo($sEmail)); $this->getTwoFactorInfo($sEmail));
} }
/**
* @return array
*/
public function DoShowTwoFactorSecret()
{
if (!$this->TwoFactorAuthProvider()->IsActive())
{
return $this->FalseResponse(__FUNCTION__);
}
$oAccount = $this->getAccountFromToken();
$sEmail = $oAccount->ParentEmailHelper();
$aResult = $this->getTwoFactorInfo($sEmail);
if (\is_array($aResult))
{
unset($aResult['BackupCodes']);
}
return $this->DefaultResponse(__FUNCTION__, $aResult);
}
/** /**
* @return array * @return array
*/ */

View file

@ -9,8 +9,8 @@
<div class="modal-body"> <div class="modal-body">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a href="#mailbox-shortcuts-id" data-toggle="tab">Mailbox</a></li> <li class="active"><a href="#mailbox-shortcuts-id" data-toggle="tab">Mailbox</a></li>
<li><a href="#message-list-shortcuts-id" data-toggle="tab">Message list (focused)</a></li> <li><a href="#message-list-shortcuts-id" data-toggle="tab">Message list</a></li>
<li><a href="#message-view-shortcuts-id" data-toggle="tab">Message view (focused)</a></li> <li><a href="#message-view-shortcuts-id" data-toggle="tab">Message view</a></li>
<li><a href="#compose-shortcuts-id" data-toggle="tab">Compose</a></li> <li><a href="#compose-shortcuts-id" data-toggle="tab">Compose</a></li>
</ul> </ul>
<br /> <br />

View file

@ -20,6 +20,7 @@
<strong><span data-bind="text: viewUser"></span></strong> <strong><span data-bind="text: viewUser"></span></strong>
</div> </div>
</div> </div>
<!--
<div class="control-group"> <div class="control-group">
<label class="control-label"> <label class="control-label">
<span class="i18n" data-i18n-text="SETTINGS_SECURITY/LABEL_TWO_FACTOR_STATUS"></span> <span class="i18n" data-i18n-text="SETTINGS_SECURITY/LABEL_TWO_FACTOR_STATUS"></span>
@ -29,6 +30,7 @@
<strong data-bind="visible: processing()">...</strong> <strong data-bind="visible: processing()">...</strong>
</div> </div>
</div> </div>
-->
<div class="control-group"> <div class="control-group">
<div class="controls"> <div class="controls">
<a class="btn" data-bind="click: clearTwoFactor, visible: twoFactorStatus"> <a class="btn" data-bind="click: clearTwoFactor, visible: twoFactorStatus">
@ -50,12 +52,21 @@
</a> </a>
</div> </div>
</div> </div>
<div class="control-group" data-bind="visible: '' === viewSecret() && twoFactorStatus() && !clearing()">
<div class="controls" style="padding-top: 5px;">
<strong data-bind="visible: secreting">...</strong>
<span class="g-ui-link i18n" data-bind="click: showSecret, visible: !secreting()"
data-i18n-text="SETTINGS_SECURITY/BUTTON_SHOW_SECRET"></span>
</div>
</div>
<div class="control-group" data-bind="visible: '' !== viewSecret()"> <div class="control-group" data-bind="visible: '' !== viewSecret()">
<label class="control-label"> <label class="control-label">
<span class="i18n" data-i18n-text="SETTINGS_SECURITY/LABEL_TWO_FACTOR_SECRET"></span> <span class="i18n" data-i18n-text="SETTINGS_SECURITY/LABEL_TWO_FACTOR_SECRET"></span>
</label> </label>
<div class="controls" style="padding-top: 5px;"> <div class="controls" style="padding-top: 5px;">
<strong data-bind="text: viewSecret"></strong> <strong data-bind="text: viewSecret"></strong>
&nbsp;&nbsp;
<span class="g-ui-link i18n" data-bind="click: hideSecret" data-i18n-text="SETTINGS_SECURITY/BUTTON_HIDE_SECRET"></span>
<br /> <br />
<br /> <br />
<blockquote> <blockquote>

View file

@ -351,6 +351,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

View file

@ -351,6 +351,10 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

View file

@ -351,6 +351,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

View file

@ -351,6 +351,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

View file

@ -351,6 +351,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

View file

@ -351,6 +351,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

View file

@ -351,6 +351,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

View file

@ -351,6 +351,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

View file

@ -348,6 +348,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

View file

@ -351,6 +351,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

View file

@ -351,6 +351,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

View file

@ -351,6 +351,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

View file

@ -350,6 +350,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

View file

@ -351,6 +351,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

View file

@ -351,6 +351,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

View file

@ -350,6 +350,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

View file

@ -351,6 +351,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Резервные коды"
BUTTON_CREATE = "Создать новый секретный ключ" BUTTON_CREATE = "Создать новый секретный ключ"
BUTTON_CLEAR = "Очистить" BUTTON_CLEAR = "Очистить"
BUTTON_TEST = "Тест" BUTTON_TEST = "Тест"
BUTTON_SHOW_SECRET = "Показать секретный ключ"
BUTTON_HIDE_SECRET = "Скрыть секретный ключ"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Настроен" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Настроен"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Не настроен" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Не настроен"
TWO_FACTOR_SECRET_DESC = "Используйте эту информацию для настройки Gooogle Authenticator клиента (или другого TOTP клиента) с помощью прилагаемого QR-кода, или вручную." TWO_FACTOR_SECRET_DESC = "Используйте эту информацию для настройки Gooogle Authenticator клиента (или другого TOTP клиента) с помощью прилагаемого QR-кода, или вручную."

View file

@ -351,6 +351,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

View file

@ -351,6 +351,8 @@ LABEL_TWO_FACTOR_BACKUP_CODES = "Backup codes"
BUTTON_CREATE = "Create New Secret" BUTTON_CREATE = "Create New Secret"
BUTTON_CLEAR = "Clear" BUTTON_CLEAR = "Clear"
BUTTON_TEST = "Test" BUTTON_TEST = "Test"
BUTTON_SHOW_SECRET = "Show Secret"
BUTTON_HIDE_SECRET = "Hide Secret"
TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured"
TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured"
TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually." TWO_FACTOR_SECRET_DESC = "Import this info into your Gooogle Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually."

File diff suppressed because one or more lines are too long

View file

@ -14175,6 +14175,7 @@ function SettingsSecurity()
{ {
this.processing = ko.observable(false); this.processing = ko.observable(false);
this.clearing = ko.observable(false); this.clearing = ko.observable(false);
this.secreting = ko.observable(false);
this.viewUser = ko.observable(''); this.viewUser = ko.observable('');
this.viewEnable = ko.observable(false); this.viewEnable = ko.observable(false);
@ -14197,10 +14198,24 @@ function SettingsSecurity()
}, this); }, this);
this.onResult = _.bind(this.onResult, this); this.onResult = _.bind(this.onResult, this);
this.onSecretResult = _.bind(this.onSecretResult, this);
} }
Utils.addSettingsViewModel(SettingsSecurity, 'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security'); 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 () SettingsSecurity.prototype.createTwoFactor = function ()
{ {
this.processing(true); this.processing(true);
@ -14281,6 +14296,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 () SettingsSecurity.prototype.onBuild = function ()
{ {
this.processing(true); this.processing(true);
@ -16632,6 +16663,14 @@ WebMailAjaxRemoteStorage.prototype.clearTwoFactor = function (fCallback)
this.defaultRequest(fCallback, 'ClearTwoFactorInfo'); this.defaultRequest(fCallback, 'ClearTwoFactorInfo');
}; };
/**
* @param {?Function} fCallback
*/
WebMailAjaxRemoteStorage.prototype.showTwoFactorSecret = function (fCallback)
{
this.defaultRequest(fCallback, 'ShowTwoFactorSecret');
};
/** /**
* @param {?Function} fCallback * @param {?Function} fCallback
* @param {string} sCode * @param {string} sCode

File diff suppressed because one or more lines are too long