Compare commits

..

2 Commits

Author SHA1 Message Date
4ecdc8968f Merge pull request 'don't spam logs with (unsuccessful) wordpress login attempts' (#189) from staging into main
All checks were successful
CI/CD Pipeline / test (push) Successful in 10m7s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Successful in 5m6s
Reviewed-on: #189
2024-01-24 13:10:02 +01:00
a6faa128ec don't spam logs with (unsuccessful) wordpress login attempts
All checks were successful
CI/CD Pipeline / test (push) Successful in 10m8s
CI/CD Pipeline / deploy-staging (push) Successful in 5m7s
CI/CD Pipeline / deploy-main (push) Has been skipped
2024-01-24 13:09:12 +01:00

View File

@ -501,7 +501,20 @@ ORDER BY last_access DESC
pub async fn login(db: &SqlitePool, name: &str, pw: &str) -> Result<Self, LoginError> { pub async fn login(db: &SqlitePool, name: &str, pw: &str) -> Result<Self, LoginError> {
let name = name.trim(); // just to make sure... let name = name.trim(); // just to make sure...
let Some(user) = User::find_by_name(db, name).await else { let Some(user) = User::find_by_name(db, name).await else {
Log::create(db, format!("Username ({name}) not found (tried to login)")).await; if ![
"n-sageder",
"p-hofer",
"m-birner",
"s-sollberger",
"d-kortschak",
"wwwadmin",
"wadminw",
"admin",
]
.contains(&name)
{
Log::create(db, format!("Username ({name}) not found (tried to login)")).await;
}
return Err(LoginError::InvalidAuthenticationCombo); // Username not found return Err(LoginError::InvalidAuthenticationCombo); // Username not found
}; };