mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Prepare more 2fa data
This commit is contained in:
parent
d9bab28bfe
commit
54d2fb93cc
2 changed files with 74 additions and 46 deletions
|
|
@ -13,40 +13,12 @@ const
|
|||
pString = value => null != value ? '' + value : '',
|
||||
|
||||
Remote = new class {
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
getTwoFactor(fCallback) {
|
||||
rl.pluginRemoteRequest(fCallback, 'GetTwoFactorInfo');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
createTwoFactor(fCallback) {
|
||||
rl.pluginRemoteRequest(fCallback, 'CreateTwoFactorSecret');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
clearTwoFactor(fCallback) {
|
||||
rl.pluginRemoteRequest(fCallback, 'ClearTwoFactorInfo');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
showTwoFactorSecret(fCallback) {
|
||||
rl.pluginRemoteRequest(fCallback, 'ShowTwoFactorSecret');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sCode
|
||||
*/
|
||||
testTwoFactor(fCallback, sCode) {
|
||||
rl.pluginRemoteRequest(fCallback, 'TestTwoFactorInfo', {
|
||||
verifyCode(fCallback, sCode) {
|
||||
rl.pluginRemoteRequest(fCallback, 'VerifyTwoFactorCode', {
|
||||
Code: sCode
|
||||
});
|
||||
}
|
||||
|
|
@ -60,13 +32,6 @@ const
|
|||
Enable: bEnable ? 1 : 0
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
clearTwoFactorInfo(fCallback) {
|
||||
rl.pluginRemoteRequest(fCallback, 'ClearTwoFactorInfo');
|
||||
}
|
||||
};
|
||||
|
||||
class TwoFactorAuthSettings
|
||||
|
|
@ -135,7 +100,7 @@ class TwoFactorAuthSettings
|
|||
|
||||
showSecret() {
|
||||
this.secreting(true);
|
||||
Remote.showTwoFactorSecret(this.onShowSecretResult);
|
||||
rl.pluginRemoteRequest(this.onShowSecretResult, 'ShowTwoFactorSecret');
|
||||
}
|
||||
|
||||
hideSecret() {
|
||||
|
|
@ -147,7 +112,7 @@ class TwoFactorAuthSettings
|
|||
|
||||
createTwoFactor() {
|
||||
this.processing(true);
|
||||
Remote.createTwoFactor(this.onResult);
|
||||
rl.pluginRemoteRequest(this.onResult, 'CreateTwoFactorSecret');
|
||||
}
|
||||
|
||||
logout() {
|
||||
|
|
@ -167,7 +132,7 @@ class TwoFactorAuthSettings
|
|||
this.twoFactorTested(false);
|
||||
|
||||
this.clearing(true);
|
||||
Remote.clearTwoFactor(this.onResult);
|
||||
rl.pluginRemoteRequest(this.onResult, 'ClearTwoFactorInfo');
|
||||
}
|
||||
|
||||
onShow(bLock) {
|
||||
|
|
@ -236,7 +201,7 @@ class TwoFactorAuthSettings
|
|||
onBuild() {
|
||||
if (this.capaTwoFactor) {
|
||||
this.processing(true);
|
||||
Remote.getTwoFactor(this.onResult);
|
||||
rl.pluginRemoteRequest(this.onResult, 'GetTwoFactorInfo');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -261,7 +226,7 @@ class TwoFactorAuthTestPopupView extends rl.pluginPopupView {
|
|||
|
||||
testCodeCommand() {
|
||||
this.testing(true);
|
||||
Remote.testTwoFactor(iError => {
|
||||
Remote.verifyCode(iError => {
|
||||
this.testing(false);
|
||||
this.codeStatus(!iError);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue