mirror of
https://github.com/Luzifer/nginx-sso.git
synced 2025-04-17 12:41:51 +00:00
Fix audit logging when not using MFA (#32)
Signed-off-by: Maximilian Gaß <m.gass@babiel.com>
This commit is contained in:
parent
3650ad66e7
commit
085a158371
1 changed files with 5 additions and 0 deletions
5
main.go
5
main.go
|
@ -185,11 +185,16 @@ func handleLoginRequest(res http.ResponseWriter, r *http.Request) {
|
|||
user, mfaCfgs, err := loginUser(res, r)
|
||||
switch err {
|
||||
case errNoValidUserFound:
|
||||
auditFields["reason"] = "invalid credentials"
|
||||
mainCfg.AuditLog.Log(auditEventLoginFailure, r, auditFields) // #nosec G104 - This is only logging
|
||||
http.Redirect(res, r, "/login?go="+url.QueryEscape(r.FormValue("go")), http.StatusFound)
|
||||
return
|
||||
case nil:
|
||||
// Don't handle for now, MFA validation comes first
|
||||
default:
|
||||
auditFields["reason"] = "error"
|
||||
auditFields["error"] = err.Error()
|
||||
mainCfg.AuditLog.Log(auditEventLoginFailure, r, auditFields) // #nosec G104 - This is only logging
|
||||
log.WithError(err).Error("Login failed with unexpected error")
|
||||
http.Redirect(res, r, "/login?go="+url.QueryEscape(r.FormValue("go")), http.StatusFound)
|
||||
return
|
||||
|
|
Loading…
Add table
Reference in a new issue