mirror of
https://github.com/volatiletech/authboss.git
synced 2024-11-24 08:42:17 +02:00
Fix bug in LoadCurrentUser error handling
This commit is contained in:
parent
8213e87e83
commit
dc5a3def97
@ -20,6 +20,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
- defaults.HTTPRedirector now always responds with a "status": "success"
|
||||
when responding to an API unless there's a failure.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix LoadCurrentUser error handling, it was swallowing errors when users were
|
||||
not logged in, changed to be consistent, now returns ErrUserNotFound just like
|
||||
CurrentUser.
|
||||
|
||||
## [2.0.0] - 2018-09-03
|
||||
|
||||
### Added
|
||||
|
@ -131,10 +131,8 @@ func (a *Authboss) LoadCurrentUser(r **http.Request) (User, error) {
|
||||
pid, err := a.LoadCurrentUserID(r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(pid) == 0 {
|
||||
return nil, nil
|
||||
} else if len(pid) == 0 {
|
||||
return nil, ErrUserNotFound
|
||||
}
|
||||
|
||||
ctx := (**r).Context()
|
||||
|
Loading…
Reference in New Issue
Block a user