@@ -166,6 +166,7 @@ pub(crate) async fn post(
166
166
}
167
167
168
168
if !form_state. is_valid ( ) {
169
+ tracing:: warn!( "Invalid login form: {form_state:?}" ) ;
169
170
PASSWORD_LOGIN_COUNTER . add ( 1 , & [ KeyValue :: new ( RESULT , "error" ) ] ) ;
170
171
return render (
171
172
locale,
@@ -189,6 +190,7 @@ pub(crate) async fn post(
189
190
// First, lookup the user
190
191
let Some ( user) = get_user_by_email_or_by_username ( site_config, & mut repo, username) . await ?
191
192
else {
193
+ tracing:: warn!( "User not found: {username}" ) ;
192
194
let form_state = form_state. with_error_on_form ( FormError :: InvalidCredentials ) ;
193
195
PASSWORD_LOGIN_COUNTER . add ( 1 , & [ KeyValue :: new ( RESULT , "error" ) ] ) ;
194
196
return render (
@@ -228,6 +230,7 @@ pub(crate) async fn post(
228
230
let Some ( user_password) = repo. user_password ( ) . active ( & user) . await ? else {
229
231
// There is no password for this user, but we don't want to disclose that. Show
230
232
// a generic 'invalid credentials' error instead
233
+ tracing:: warn!( "No password for user: {user}" ) ;
231
234
let form_state = form_state. with_error_on_form ( FormError :: InvalidCredentials ) ;
232
235
PASSWORD_LOGIN_COUNTER . add ( 1 , & [ KeyValue :: new ( RESULT , "error" ) ] ) ;
233
236
return render (
@@ -271,6 +274,7 @@ pub(crate) async fn post(
271
274
}
272
275
Ok ( None ) => user_password,
273
276
Err ( _) => {
277
+ tracing:: warn!( "Failed to verify/upgrade password for user: {user}" ) ;
274
278
let form_state = form_state. with_error_on_form ( FormError :: InvalidCredentials ) ;
275
279
PASSWORD_LOGIN_COUNTER . add ( 1 , & [ KeyValue :: new ( RESULT , "error" ) ] ) ;
276
280
return render (
@@ -291,6 +295,7 @@ pub(crate) async fn post(
291
295
// Now that we have checked the user password, we now want to show an error if
292
296
// the user is locked or deactivated
293
297
if user. deactivated_at . is_some ( ) {
298
+ tracing:: warn!( "User is deactivated: {user}" ) ;
294
299
PASSWORD_LOGIN_COUNTER . add ( 1 , & [ KeyValue :: new ( RESULT , "error" ) ] ) ;
295
300
let ( csrf_token, cookie_jar) = cookie_jar. csrf_token ( & clock, & mut rng) ;
296
301
let ctx = AccountInactiveContext :: new ( user)
@@ -301,6 +306,7 @@ pub(crate) async fn post(
301
306
}
302
307
303
308
if user. locked_at . is_some ( ) {
309
+ tracing:: warn!( "User is locked: {user}" ) ;
304
310
PASSWORD_LOGIN_COUNTER . add ( 1 , & [ KeyValue :: new ( RESULT , "error" ) ] ) ;
305
311
let ( csrf_token, cookie_jar) = cookie_jar. csrf_token ( & clock, & mut rng) ;
306
312
let ctx = AccountInactiveContext :: new ( user)
0 commit comments