fix(auth): eager load the account relation to return it
This commit is contained in:
parent
934f8e6236
commit
a23d165caa
|
@ -249,7 +249,7 @@ func VerifyLoginToken(token string) (*model.Account, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
session := model.LoginSession{}
|
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))
|
logger.Get().Debug(ErrInvalidToken.Error(), zap.Error(err), zap.String("token", token))
|
||||||
return nil, ErrInvalidToken
|
return nil, ErrInvalidToken
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue