mirror of
https://git.sr.ht/~sircmpwn/tokidoki
synced 2025-12-12 14:17:21 +01:00
auth/*: more consistent logging
This commit is contained in:
parent
96e33a0777
commit
a115c50037
2 changed files with 6 additions and 6 deletions
|
|
@ -44,26 +44,26 @@ func pamAuth(next http.Handler, w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
})
|
||||
if err != nil {
|
||||
log.Debug().Err(err).Msg("failed to start PAM conversation")
|
||||
log.Warn().Err(err).Msg("failed to start PAM conversation")
|
||||
http.Error(w, "Temporary authentication error, try again later", http.StatusServiceUnavailable)
|
||||
return
|
||||
}
|
||||
|
||||
if err := t.Authenticate(0); err != nil {
|
||||
log.Debug().Err(err).Msg("auth error")
|
||||
log.Debug().Str("user", user).Err(err).Msg("auth error")
|
||||
http.Error(w, "Invalid username or password", http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
if err := t.AcctMgmt(0); err != nil {
|
||||
log.Debug().Err(err).Msg("account unavailable")
|
||||
log.Debug().Str("user", user).Err(err).Msg("account unavailable")
|
||||
http.Error(w, "Account unavailable", http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
user, err = t.GetItem(pam.User)
|
||||
if err != nil {
|
||||
log.Debug().Err(err).Msg("failed to get PAM username")
|
||||
log.Warn().Str("user", user).Err(err).Msg("failed to get PAM username")
|
||||
http.Error(w, "Temporary authentication error, try again later", http.StatusServiceUnavailable)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue