home to your local SPACEGIRL 💫 arimelody.space
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

log IP address for account locks :troll:

+5 -4
+5 -4
admin/http.go
··· 283 283 err = bcrypt.CompareHashAndPassword([]byte(account.Password), []byte(password)) 284 284 if err != nil { 285 285 app.Log.Warn(log.TYPE_ACCOUNT, "\"%s\" attempted login with incorrect password. (%s)", account.Username, controller.ResolveIP(app, r)) 286 - if locked := handleFailedLogin(app, account); locked { 286 + if locked := handleFailedLogin(app, account, r); locked { 287 287 controller.SetSessionError(app.DB, session, "Too many failed attempts. This account is now locked.") 288 288 } else { 289 289 controller.SetSessionError(app.DB, session, "Invalid username or password.") ··· 389 389 } 390 390 if totpMethod == nil { 391 391 app.Log.Warn(log.TYPE_ACCOUNT, "\"%s\" failed login (Incorrect TOTP). (%s)", session.AttemptAccount.Username, controller.ResolveIP(app, r)) 392 - if locked := handleFailedLogin(app, session.AttemptAccount); locked { 392 + if locked := handleFailedLogin(app, session.AttemptAccount, r); locked { 393 393 controller.SetSessionError(app.DB, session, "Too many failed attempts. This account is now locked.") 394 394 controller.SetSessionAttemptAccount(app.DB, session, nil) 395 395 http.Redirect(w, r, "/admin", http.StatusFound) ··· 514 514 }) 515 515 } 516 516 517 - func handleFailedLogin(app *model.AppState, account *model.Account) bool { 517 + func handleFailedLogin(app *model.AppState, account *model.Account, r *http.Request) bool { 518 518 locked, err := controller.IncrementAccountFails(app.DB, account.ID) 519 519 if err != nil { 520 520 fmt.Fprintf( ··· 532 532 if locked { 533 533 app.Log.Warn( 534 534 log.TYPE_ACCOUNT, 535 - "Account \"%s\" was locked: %d failed login attempts", 535 + "Account \"%s\" was locked: %d failed login attempts (IP: %s)", 536 536 account.Username, 537 537 model.MAX_LOGIN_FAIL_ATTEMPTS, 538 + controller.ResolveIP(app, r), 538 539 ) 539 540 } 540 541 return locked