fix: error if user is nil

This commit is contained in:
Derrick Hammer 2024-03-16 21:31:09 -04:00
parent 3dc5c72840
commit 193871f083
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 1 deletions

View File

@ -111,7 +111,11 @@ func (a AccountAPI) login(jc jape.Context) {
} }
jwt, user, err := a.accounts.LoginPassword(request.Email, request.Password, jc.Request.RemoteAddr) jwt, user, err := a.accounts.LoginPassword(request.Email, request.Password, jc.Request.RemoteAddr)
if err != nil || user == nil {
_ = jc.Error(account.NewAccountError(account.ErrKeyInvalidLogin, err), http.StatusUnauthorized)
if err != nil { if err != nil {
a.logger.Error("failed to login", zap.Error(err))
}
return return
} }