Class EnableAuthenticatorForm
Represents the confirmation that turns on two-factor authentication: the first code the user's authenticator app produced after reading the shared key.
public class EnableAuthenticatorForm
- Inheritance
-
EnableAuthenticatorForm
- Inherited Members
Remarks
Proving the app produces valid codes before enabling two-factor authentication is what keeps a mistyped key from locking the user out.
Properties
Code
Gets or sets the code shown by the authenticator app.
[Display(Name = "VerificationCode", ResourceType = typeof(Fields))]
[Required(ErrorMessageResourceName = "XRequired", ErrorMessageResourceType = typeof(Messages))]
[MinLength(6, ErrorMessageResourceName = "XMustHaveAtLeastYCharacters", ErrorMessageResourceType = typeof(Messages))]
[MaxLength(7, ErrorMessageResourceName = "XMustHaveUpToYCharacters", ErrorMessageResourceType = typeof(Messages))]
public virtual string? Code { get; set; }
Property Value
Remarks
Six digits; up to seven characters so a code typed with a space still passes. Strip spaces and hyphens before verifying it.