fix: error if user is nil
This commit is contained in:
parent
3dc5c72840
commit
193871f083
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue