File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,14 @@ func WebAuthn(ctx *context.Context) {
3737 return
3838 }
3939
40+ hasTwoFactor , err := auth .HasTwoFactorByUID (ctx , ctx .Session .Get ("twofaUid" ).(int64 ))
41+ if err != nil {
42+ ctx .ServerError ("HasTwoFactorByUID" , err )
43+ return
44+ }
45+
46+ ctx .Data ["HasTwoFactor" ] = hasTwoFactor
47+
4048 ctx .HTML (http .StatusOK , tplWebAuthn )
4149}
4250
Original file line number Diff line number Diff line change 1414 <div class="is-loading" style="width: 40px; height: 40px"></div>
1515 {{ctx.Locale.Tr "webauthn_press_button"}}
1616 </div>
17- <div class="ui attached segment">
18- <a href="{{AppSubUrl}}/user/two_factor">{{ctx.Locale.Tr "webauthn_use_twofa"}}</a>
19- </div>
17+ {{if .HasTwoFactor}}
18+ <div class="ui attached segment">
19+ <a href="{{AppSubUrl}}/user/two_factor">{{ctx.Locale.Tr "webauthn_use_twofa"}}</a>
20+ </div>
21+ {{end}}
2022 </div>
2123 </div>
2224</div>
You can’t perform that action at this time.
0 commit comments