diff options
author | JakobDev <jakobdev@gmx.de> | 2023-10-11 22:12:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-11 20:12:54 +0000 |
commit | 328da56a28b9dd436c8ca4c961e4e10f3517c4b1 (patch) | |
tree | 2cd6cdb1a59342f0091a4f952aace9a00ae10d72 /routers/web | |
parent | 1d155a43adfb97e486c1378eef682b1912132005 (diff) | |
download | gitea-328da56a28b9dd436c8ca4c961e4e10f3517c4b1.tar.gz gitea-328da56a28b9dd436c8ca4c961e4e10f3517c4b1.zip |
Don't show Link to TOTP if not set up (#27585)
Diffstat (limited to 'routers/web')
-rw-r--r-- | routers/web/auth/webauthn.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/routers/web/auth/webauthn.go b/routers/web/auth/webauthn.go index 88413caea6..9b516ce396 100644 --- a/routers/web/auth/webauthn.go +++ b/routers/web/auth/webauthn.go @@ -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) } |