@@ -114,7 +114,7 @@ var (
114114 prometheus.CounterOpts {
115115 Namespace : metricNamespace ,
116116 Subsystem : authSubsystem ,
117- Name : "failed_total " ,
117+ Name : "results_total " ,
118118 Help : "Number of failed auth attempts" ,
119119 },
120120 []string {"target" , "status" },
@@ -169,22 +169,30 @@ func (a *FileBasedAuthenticator) AuthUser(code string, target Target) (result Au
169169 defer authCounter .WithLabelValues (target .String (), result .String ()).Inc ()
170170
171171 if ! hasMinimalCodeRequirements (code ) {
172- return AuthFail , "Auth failed: too short code."
172+ result = AuthFail
173+ return result , "Auth failed: too short code."
173174 }
174175 user := a .findUserSynchronized (code , nil )
175176 if user == nil {
176- return AuthFail , "No user for code"
177+ result = AuthFail
178+ message = "No user for code"
179+ return
177180 }
178181 // In case of Hiatus users, be a bit more specific with logging: this
179182 // might be someone stolen a token of some person on leave or attempt
180183 // of a blocked user to get access.
181184 if user .UserLevel == LevelHiatus {
182- return AuthFail , fmt .Sprintf ("User on hiatus '%s <%s>'" , user .Name , user .ContactInfo )
185+ result = AuthFail
186+ message = fmt .Sprintf ("User on hiatus '%s <%s>'" , user .Name , user .ContactInfo )
187+ return
183188 }
184189 if ! user .InValidityPeriod (a .clock .Now ()) {
185- return AuthExpired , "Code not valid yet/expired"
190+ result = AuthExpired
191+ message = "Code not valid yet/expired"
192+ return
186193 }
187- return a .userHasAccess (user , target )
194+ result , message = a .userHasAccess (user , target )
195+ return
188196}
189197
190198func (a * FileBasedAuthenticator ) AddNewUser (authentication_code string , user User ) (bool , string ) {
0 commit comments