1
0
Fork 0
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 ()

Signed-off-by: Maximilian Gaß <m.gass@babiel.com>
This commit is contained in:
Maximilian Gaß 2019-01-17 23:50:18 +01:00 committed by Knut Ahlers
parent 3650ad66e7
commit 085a158371

View file

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