Avoid crashing when getting oauth with an expired user
This commit is contained in:
parent
41587c3694
commit
df3a171b0d
2 changed files with 2 additions and 1 deletions
2
auth.go
2
auth.go
|
|
@ -48,7 +48,7 @@ func (ea *EnsureAuth) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
content_type := NegotiateContent(accept, offers)
|
||||
user, err := getAuthenticatedUser(r)
|
||||
if err != nil {
|
||||
if err != nil || user == nil {
|
||||
var msg []byte
|
||||
// Separate return codes for different authentication failures
|
||||
if _, ok := err.(*NoCredentialsError); ok {
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ func getOAuthRefresh(w http.ResponseWriter, r *http.Request) {
|
|||
user, err := getAuthenticatedUser(r)
|
||||
if err != nil {
|
||||
http.Redirect(w, r, "/?next=/oauth/refresh", http.StatusFound)
|
||||
return
|
||||
}
|
||||
htmlOauthPrompt(w, user)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue