decord/source/actions/MFAActionCreators.tsx
github-actions 20a21ad13f chore: update source for alpha 346.5
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4791.js (118.4 MB)
2026-09-11 19:12:58 +00:00

82 lines
3.6 KiB
TypeScript

// Module ID: 14732
// Function ID: 14733
// Name: MFAActionCreators
// Dependencies: [13801, 1074, 1272, 573, 2]
// Module 14732 (MFAActionCreators)
import DispatcherDefault from "Dispatcher" /* 573 */;
import HTTPUtils from "HTTPUtils" /* 1272 */;
import MFAStore from "MFAStore" /* 13801 */;
const require = globalThis.__r;
require = fn;
const Endpoints = fn(1074).Endpoints;
const size = fn(2);
const result = size.fileFinishedImporting("actions/MFAActionCreators.tsx");
export default {
enable(arg0) {
({ code, secret } = arg0);
const HTTP = HTTPUtils.HTTP;
const request = { url: Endpoints.MFA_TOTP_ENABLE, body: { code, secret }, oldFormErrors: true, rejectWithError: HTTPUtils.rejectWithMigratedError() };
return HTTP.post(request).then((body) => DispatcherDefault.dispatch({ type: "MFA_ENABLE_SUCCESS", token: body.body.token, codes: body.body.backup_codes }));
},
disable() {
const HTTP = HTTPUtils.HTTP;
const obj = { url: Endpoints.MFA_TOTP_DISABLE, oldFormErrors: true, rejectWithError: HTTPUtils.rejectWithMigratedError() };
HTTP.post(obj).then((token) => DispatcherDefault.dispatch({ type: "MFA_DISABLE_SUCCESS", token: token.body.token }));
},
enableSMS() {
DispatcherDefault.dispatch({ type: "MFA_SMS_TOGGLE" });
const HTTP = HTTPUtils.HTTP;
const obj2 = { url: Endpoints.MFA_SMS_ENABLE, oldFormErrors: true, rejectWithError: null };
obj2.rejectWithError = HTTPUtils.rejectWithMigratedError();
return HTTP.post(obj2).then((result) => {
DispatcherDefault.dispatch({ type: "MFA_SMS_TOGGLE_COMPLETE" });
return result;
}, (arg0) => {
DispatcherDefault.dispatch({ type: "MFA_SMS_TOGGLE_COMPLETE" });
throw arg0;
});
},
disableSMS(password) {
DispatcherDefault.dispatch({ type: "MFA_SMS_TOGGLE" });
const HTTP = HTTPUtils.HTTP;
const request = { url: Endpoints.MFA_SMS_DISABLE, body: { password }, oldFormErrors: true, rejectWithError: null };
const obj2 = { password };
request.rejectWithError = HTTPUtils.rejectWithMigratedError();
return HTTP.post(request).then((result) => {
DispatcherDefault.dispatch({ type: "MFA_SMS_TOGGLE_COMPLETE" });
return result;
}, (arg0) => {
DispatcherDefault.dispatch({ type: "MFA_SMS_TOGGLE_COMPLETE" });
throw arg0;
});
},
sendMFABackupCodesVerificationKeyEmail(password) {
const HTTP = HTTPUtils.HTTP;
const request = { url: Endpoints.MFA_SEND_VERIFICATION_KEY, body: { password }, oldFormErrors: true, rejectWithError: HTTPUtils.rejectWithMigratedError() };
const obj = { password };
return HTTP.post(request).then((viewNonce) => DispatcherDefault.dispatch({ type: "MFA_SEND_VERIFICATION_KEY", nonces: { viewNonce: viewNonce.body.nonce, regenerateNonce: viewNonce.body.regenerate_nonce } }), (arg0) => {
throw arg0;
});
},
confirmViewBackupCodes(verificationKey, regenerate) {
_require = verificationKey;
const nonces = MFAStore.getNonces();
let regenerateNonce = nonces.viewNonce;
if (regenerate) {
regenerateNonce = nonces.regenerateNonce;
}
const HTTP = require("HTTPUtils").HTTP;
const request = { url: Endpoints.MFA_CODES_VERIFICATION, body: { key: verificationKey, nonce: regenerateNonce, regenerate }, oldFormErrors: true, rejectWithError: require("HTTPUtils").rejectWithMigratedError() };
const obj2 = require("HTTPUtils");
return HTTP.post(request).then((body) => DispatcherDefault.dispatch({ type: "MFA_VIEW_BACKUP_CODES", codes: body.body.backup_codes, key }), (arg0) => {
throw arg0;
});
},
clearBackupCodes() {
DispatcherDefault.dispatch({ type: "MFA_CLEAR_BACKUP_CODES" });
}
};