Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | 1x 1x 1x 1x 1x 1x 1x 1x 20x 20x 20x 20x 13x 13x 13x 13x 13x 13x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 27x 27x 27x 20x 20x 20x 20x 20x 20x 20x 20x 20x 27x 27x 27x 20x 20x 20x 20x 20x 20x 1x 1x 20x 20x 1x 1x 20x 20x 1x 1x 20x 20x 1x | import {Resources} from "../../../lib/resources/main.js";
import {TrustedPhoneNumber} from "../../../lib/resources/network-types.js";
import {requestMfaCSS, requestMfaCSSDark} from "../css/request-mfa-css.js";
import {requestMfaScript} from "../scripts/request-mfa-scripts.js";
import {View} from "./base.js";
export class RequestMfaView extends View {
protected override get content(): string {
const storedPhoneNumbers = Resources.state().trustedPhoneNumbers;
// Falling back to Apple's default number (without id), if no trusted phone numbers are known
const trustedPhoneNumbers: (Partial<Pick<TrustedPhoneNumber, `id`>> & Pick<TrustedPhoneNumber, `numberWithDialCode`>)[] = Array.isArray(storedPhoneNumbers) && storedPhoneNumbers.length > 0 ?
storedPhoneNumbers :
[
{
id: undefined,
numberWithDialCode: `Default`
}
]
return `
<!-- Options are sms, voice, device -->
<h2>Choose MFA Method</h2>
<!-- Device button -->
<button class="request-buttons" onclick="requestMfaWithMethod('device')" id="device-button">
Send to My Devices
</button>
<!-- SMS button with expandable phone options -->
<button class="request-buttons" onclick="togglePhoneOptions('sms')" id="sms-button">
Send SMS
</button>
<div class="phone-options" id="sms-options">
${trustedPhoneNumbers.map((value => `
<div id="sms-option-${value.id}" class="request-buttons phone-option" onclick="requestMfaWithMethod('sms', ${value.id})">
<span class="phone-display">${value.numberWithDialCode}</span>
</div>
`))}
</div>
<!-- Voice button with expandable phone options -->
<button class="request-buttons" onclick="togglePhoneOptions('voice')" id="voice-button">
Receive a Call
</button>
<div class="phone-options" id="voice-options">
${trustedPhoneNumbers.map((value => `
<div id="voice-option-${value.id}" class="request-buttons phone-option" onclick="requestMfaWithMethod('voice', ${value.id})">
<span class="phone-display">${value.numberWithDialCode}</span>
</div>
`))}
</div>
<button class="inverted" onclick="navigate('${Resources.manager().webBasePath}/submit-mfa')" id="cancel-button">Cancel</button>
`;
}
get scripts() {
return [...super.scripts, requestMfaScript]
}
get css() {
return [...super.css, requestMfaCSS]
}
get cssDark() {
return [...super.cssDark, requestMfaCSSDark]
}
}
|