fix(auth): eager load the account relation to return it

This commit is contained in:
Derrick Hammer 2023-06-29 07:04:24 -04:00
parent 934f8e6236
commit a23d165caa
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 1 additions and 1 deletions

View File

@ -249,7 +249,7 @@ func VerifyLoginToken(token string) (*model.Account, error) {
}
session := model.LoginSession{}
if err := db.Get().Model(session).Where("token = ?", token).First(&session).Error; err != nil {
if err := db.Get().Model(session).Preload("Account").Where("token = ?", token).First(&session).Error; err != nil {
logger.Get().Debug(ErrInvalidToken.Error(), zap.Error(err), zap.String("token", token))
return nil, ErrInvalidToken
}