fix: PostPubkeyLogin should not preload any model

This commit is contained in:
Derrick Hammer 2023-06-06 22:28:58 -04:00
parent 09d53ffa76
commit 27e7ea7d7a
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 1 additions and 1 deletions

View File

@ -241,7 +241,7 @@ func (a *AuthController) PostPubkeyLogin() {
// Retrieve the key challenge for the given challenge. // Retrieve the key challenge for the given challenge.
challenge := model.KeyChallenge{} challenge := model.KeyChallenge{}
if err := db.Get().Where("challenge = ?", r.Challenge).Preload("Key").First(&challenge).Error; err != nil { if err := db.Get().Where("challenge = ?", r.Challenge).First(&challenge).Error; err != nil {
msg := "invalid key challenge" msg := "invalid key challenge"
logger.Get().Debug(msg, zap.Error(err), zap.String("challenge", r.Challenge)) logger.Get().Debug(msg, zap.Error(err), zap.String("challenge", r.Challenge))
a.Ctx.StopWithError(iris.StatusBadRequest, errorx.RejectedOperation.New(msg)) a.Ctx.StopWithError(iris.StatusBadRequest, errorx.RejectedOperation.New(msg))