@page "//auth/challenge/{id:guid}/select-factor" @using DysonNetwork.Sphere.Account @model DysonNetwork.Sphere.Pages.Auth.SelectFactorModel @{ ViewData["Title"] = "Select Authentication Method | Solar Network"; }

Select Authentication Method

@if (Model.AuthChallenge != null && Model.AuthChallenge.StepRemain > 0) {

Progress: @(Model.AuthChallenge.StepTotal - Model.AuthChallenge.StepRemain) of @Model.AuthChallenge.StepTotal steps completed

} @if (Model.AuthChallenge == null) {
Challenge not found or expired.
} else if (Model.AuthChallenge.StepRemain == 0) {
Challenge completed. Redirecting...
} else {

Please select an authentication method:

@foreach (var factor in Model.AuthFactors) {
@if (factor.Type == AccountAuthFactorType.EmailCode) {

@GetFactorDisplayName(factor.Type)

@GetFactorDescription(factor.Type)

} else {

@GetFactorDisplayName(factor.Type)

@GetFactorDescription(factor.Type)

}
}
}
@functions { private string GetFactorDisplayName(AccountAuthFactorType type) => type switch { AccountAuthFactorType.InAppCode => "Authenticator App", AccountAuthFactorType.EmailCode => "Email", AccountAuthFactorType.TimedCode => "Timed Code", AccountAuthFactorType.PinCode => "PIN Code", AccountAuthFactorType.Password => "Password", _ => type.ToString() }; private string GetFactorDescription(AccountAuthFactorType type) => type switch { AccountAuthFactorType.InAppCode => "Enter a code from your authenticator app", AccountAuthFactorType.EmailCode => "Receive a verification code via email", AccountAuthFactorType.TimedCode => "Use a time-based verification code", AccountAuthFactorType.PinCode => "Enter your PIN code", AccountAuthFactorType.Password => "Enter your password", _ => string.Empty }; }