Avoid crashing when getting oauth with an expired user

This commit is contained in:
Eli Ribble 2025-11-24 18:09:06 +00:00
parent 41587c3694
commit df3a171b0d
No known key found for this signature in database
2 changed files with 2 additions and 1 deletions

View file

@ -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 {

View file

@ -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)
}