fix: PostPubkeyChallenge should not be checking email, but pubkey
This commit is contained in:
parent
c20dec0204
commit
db3ba1f014
|
@ -202,14 +202,14 @@ func (a *AuthController) PostPubkeyChallenge() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve the account for the given email.
|
// Retrieve the account for the given email.
|
||||||
account := model.Account{}
|
account := model.Key{}
|
||||||
if err := db.Get().Where("email = ?", r.Email).First(&account).Error; err != nil {
|
if err := db.Get().Where("pubkey = ?", r.Pubkey).First(&account).Error; err != nil {
|
||||||
a.Ctx.StopWithError(iris.StatusBadRequest, errors.New("invalid email or password"))
|
a.Ctx.StopWithError(iris.StatusBadRequest, errors.New("invalid pubkey"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate a random challenge string.
|
// Generate a random challenge string.
|
||||||
challenge, err := generateAndSaveChallengeToken(account.ID, time.Minute)
|
challenge, err := generateAndSaveChallengeToken(account.AccountID, time.Minute)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.Ctx.StopWithError(iris.StatusInternalServerError, errors.New("failed to generate challenge"))
|
a.Ctx.StopWithError(iris.StatusInternalServerError, errors.New("failed to generate challenge"))
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue