fix: check credential existence when signing via WebAuthn (#1336)

* fix: check credential existence when signing via WebAuthn

* fix review problem
This commit is contained in:
Mr Forest
2022-11-28 21:47:17 +08:00
committed by GitHub
parent 6e6a0a074a
commit 8890d1d7c7
9 changed files with 15 additions and 2 deletions

View File

@ -104,6 +104,11 @@ func (c *ApiController) WebAuthnSigninBegin() {
c.ResponseError(fmt.Sprintf(c.T("UserErr.DoNotExistInOrg"), userOwner, userName))
return
}
if len(user.WebauthnCredentials) == 0 {
c.ResponseError(c.T("UserErr.NoWebAuthnCredential"))
return
}
options, sessionData, err := webauthnObj.BeginLogin(user)
if err != nil {
c.ResponseError(err.Error())