Pārlūkot izejas kodu

Don't show Link to TOTP if not set up (#27585)

tags/v1.22.0-rc0
JakobDev pirms 8 mēnešiem
vecāks
revīzija
328da56a28
Revīzijas autora e-pasta adrese nav piesaistīta nevienam kontam
2 mainītis faili ar 13 papildinājumiem un 3 dzēšanām
  1. 8
    0
      routers/web/auth/webauthn.go
  2. 5
    3
      templates/user/auth/webauthn.tmpl

+ 8
- 0
routers/web/auth/webauthn.go Parādīt failu

@@ -37,6 +37,14 @@ func WebAuthn(ctx *context.Context) {
return
}

hasTwoFactor, err := auth.HasTwoFactorByUID(ctx, ctx.Session.Get("twofaUid").(int64))
if err != nil {
ctx.ServerError("HasTwoFactorByUID", err)
return
}

ctx.Data["HasTwoFactor"] = hasTwoFactor

ctx.HTML(http.StatusOK, tplWebAuthn)
}


+ 5
- 3
templates/user/auth/webauthn.tmpl Parādīt failu

@@ -14,9 +14,11 @@
<div class="is-loading" style="width: 40px; height: 40px"></div>
{{ctx.Locale.Tr "webauthn_press_button"}}
</div>
<div class="ui attached segment">
<a href="{{AppSubUrl}}/user/two_factor">{{ctx.Locale.Tr "webauthn_use_twofa"}}</a>
</div>
{{if .HasTwoFactor}}
<div class="ui attached segment">
<a href="{{AppSubUrl}}/user/two_factor">{{ctx.Locale.Tr "webauthn_use_twofa"}}</a>
</div>
{{end}}
</div>
</div>
</div>

Notiek ielāde…
Atcelt
Saglabāt