1- @page
2- @using Microsoft .AspNetCore .Http .Features
3- @model TwoFactorAuthenticationModel
4- @{
5- ViewData [" Title" ] = " Two-factor authentication (2FA)" ;
6- ViewData [" ActivePage" ] = ManageNavPages .TwoFactorAuthentication ;
7- }
8-
9- <partial name =" _StatusMessage" for =" StatusMessage" />
10- <h3 >@ViewData ["Title"]</h3 >
11- @{
12- var consentFeature = HttpContext .Features .Get <ITrackingConsentFeature >();
13- @if (consentFeature ? .CanTrack ?? true )
14- {
15- @if (Model .Is2faEnabled )
16- {
17- if (Model .RecoveryCodesLeft == 0 )
18- {
19- < div class = " alert alert-danger" >
20- < strong > You have no recovery codes left .< / strong >
21- < p > You must < a asp - page = " ./GenerateRecoveryCodes" > generate a new set of recovery codes < / a > before you can log in with a recovery code .< / p >
22- < / div >
23- }
24- else if (Model .RecoveryCodesLeft == 1 )
25- {
26- <div class =" alert alert-danger" >
27- <strong >You have 1 recovery code left .</strong >
28- <p >You can <a asp-page =" ./GenerateRecoveryCodes" >generate a new set of recovery codes </a >.</p >
29- </div >
30- }
31- else if (Model .RecoveryCodesLeft <= 3 )
32- {
33- <div class =" alert alert-warning" >
34- <strong >You have @Model.RecoveryCodesLeft recovery codes left .</strong >
35- <p >You should <a asp-page =" ./GenerateRecoveryCodes" >generate a new set of recovery codes </a >.</p >
36- </div >
37- }
38-
39- if (Model .IsMachineRemembered )
40- {
41- < form method = " post" style = " display: inline-block" >
42- < button type = " submit" class = " btn btn-primary" > Forget this browser < / button >
43- < / form >
44- }
45- <a asp-page =" ./Disable2fa" class =" btn btn-primary" >Disable 2FA </a >
46- <a asp-page =" ./GenerateRecoveryCodes" class =" btn btn-primary" >Reset recovery codes </a >
47- }
48-
49- <h4 >Authenticator app </h4 >
50- @if (! Model .HasAuthenticator )
51- {
52- <a id =" enable-authenticator" asp-page =" ./EnableAuthenticator" class =" btn btn-primary" >Add authenticator app </a >
53- }
54- else
55- {
56- <a id =" enable-authenticator" asp-page =" ./EnableAuthenticator" class =" btn btn-primary" >Set up authenticator app </a >
57- <a id =" reset-authenticator" asp-page =" ./ResetAuthenticator" class =" btn btn-primary" >Reset authenticator app </a >
58- }
59- }
60- else
61- {
62- <div class =" alert alert-danger" >
63- <strong >Privacy and cookie policy have not been accepted .</strong >
64- <p >You must accept the policy before you can enable two factor authentication .</p >
65- </div >
66- }
67- }
68-
69- <a id =" enable-fido2mfa" asp-page =" ./Fido2Mfa" class =" btn btn-primary" >Add Fido2 MFA</a >
70-
71- @section Scripts {
72- <partial name =" _ValidationScriptsPartial" />
73- }
1+ @page
2+ @using Microsoft .AspNetCore .Http .Features
3+ @model TwoFactorAuthenticationModel
4+ @{
5+ ViewData [" Title" ] = " Two-factor authentication (2FA)" ;
6+ ViewData [" ActivePage" ] = ManageNavPages .TwoFactorAuthentication ;
7+ }
8+
9+ <partial name =" _StatusMessage" for =" StatusMessage" />
10+ <h3 >@ViewData ["Title"]</h3 >
11+ @{
12+ var consentFeature = HttpContext .Features .Get <ITrackingConsentFeature >();
13+ @if (consentFeature ? .CanTrack ?? true )
14+ {
15+ @if (Model .Is2faEnabled )
16+ {
17+ if (Model .RecoveryCodesLeft == 0 )
18+ {
19+ < div class = " alert alert-danger" >
20+ < strong > You have no recovery codes left .< / strong >
21+ < p > You must < a asp - page = " ./GenerateRecoveryCodes" > generate a new set of recovery codes < / a > before you can log in with a recovery code .< / p >
22+ < / div >
23+ }
24+ else if (Model .RecoveryCodesLeft == 1 )
25+ {
26+ <div class =" alert alert-danger" >
27+ <strong >You have 1 recovery code left .</strong >
28+ <p >You can <a asp-page =" ./GenerateRecoveryCodes" >generate a new set of recovery codes </a >.</p >
29+ </div >
30+ }
31+ else if (Model .RecoveryCodesLeft <= 3 )
32+ {
33+ <div class =" alert alert-warning" >
34+ <strong >You have @Model.RecoveryCodesLeft recovery codes left .</strong >
35+ <p >You should <a asp-page =" ./GenerateRecoveryCodes" >generate a new set of recovery codes </a >.</p >
36+ </div >
37+ }
38+
39+ if (Model .IsMachineRemembered )
40+ {
41+ < form method = " post" style = " display: inline-block" >
42+ < button type = " submit" class = " btn btn-primary" > Forget this browser < / button >
43+ < / form >
44+ }
45+ <a asp-page =" ./Disable2fa" class =" btn btn-primary" >Disable 2FA </a >
46+ <a asp-page =" ./GenerateRecoveryCodes" class =" btn btn-primary" >Reset recovery codes </a >
47+ }
48+
49+ <h4 >Authenticator app </h4 >
50+ @if (! Model .HasAuthenticator )
51+ {
52+ <a id =" enable-authenticator" asp-page =" ./EnableAuthenticator" class =" btn btn-primary" >Add authenticator app </a >
53+ }
54+ else
55+ {
56+ <a id =" enable-authenticator" asp-page =" ./EnableAuthenticator" class =" btn btn-primary" >Set up authenticator app </a >
57+ <a id =" reset-authenticator" asp-page =" ./ResetAuthenticator" class =" btn btn-primary" >Reset authenticator app </a >
58+ }
59+ }
60+ else
61+ {
62+ <div class =" alert alert-danger" >
63+ <strong >Privacy and cookie policy have not been accepted .</strong >
64+ <p >You must accept the policy before you can enable two factor authentication .</p >
65+ </div >
66+ }
67+ }
68+
69+ <a id =" enable-fido2mfa" asp-page =" ./Fido2Mfa" class =" btn btn-primary" >Add Fido2 MFA</a >
70+
71+ @section Scripts {
72+ <script src =" ~/lib/jquery-validation/dist/jquery.validate.min.js" ></script >
73+ <script src =" ~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js" ></script >
74+ }
0 commit comments