mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-21 14:09:34 +01:00
feat: add support for adding fallback 2fa method
This commit is contained in:
@@ -47,11 +47,33 @@ class MFAManager {
|
||||
* @returns
|
||||
*/
|
||||
async enable(type, code) {
|
||||
return this._enable(type, code, false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {"app" | "sms" | "email"} type
|
||||
* @param {string} code
|
||||
* @returns
|
||||
*/
|
||||
async enableFallback(type, code) {
|
||||
return this._enable(type, code);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {"app" | "sms" | "email"} type
|
||||
* @param {string} code
|
||||
* @param {boolean} isFallback
|
||||
* @private
|
||||
* @returns
|
||||
*/
|
||||
async _enable(type, code, isFallback) {
|
||||
const token = await this.tokenManager.getAccessToken();
|
||||
if (!token) return;
|
||||
return await http.post(
|
||||
`${constants.AUTH_HOST}${ENDPOINTS.enable}`,
|
||||
{ type, code },
|
||||
{ type, code, isFallback },
|
||||
token
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user