only log useragent on succ login
This commit is contained in:
parent
aa70c61478
commit
8c6fcd7fb0
@ -66,11 +66,6 @@ async fn login(
|
|||||||
cookies: &CookieJar<'_>,
|
cookies: &CookieJar<'_>,
|
||||||
agent: UserAgent,
|
agent: UserAgent,
|
||||||
) -> Flash<Redirect> {
|
) -> Flash<Redirect> {
|
||||||
Log::create(
|
|
||||||
db,
|
|
||||||
format!("{} has this useragent: {:?}", login.name, agent),
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
let user = match User::login(db, login.name, login.password).await {
|
let user = match User::login(db, login.name, login.password).await {
|
||||||
Ok(user) => user,
|
Ok(user) => user,
|
||||||
Err(LoginError::NoPasswordSet(user)) => {
|
Err(LoginError::NoPasswordSet(user)) => {
|
||||||
@ -87,6 +82,15 @@ async fn login(
|
|||||||
let user_json: String = format!("{}", json!(user));
|
let user_json: String = format!("{}", json!(user));
|
||||||
cookies.add_private(Cookie::new("loggedin_user", user_json));
|
cookies.add_private(Cookie::new("loggedin_user", user_json));
|
||||||
|
|
||||||
|
Log::create(
|
||||||
|
db,
|
||||||
|
format!(
|
||||||
|
"Succ login of {} with this useragent: {:?}",
|
||||||
|
login.name, agent
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
Flash::success(Redirect::to("/"), "Login erfolgreich")
|
Flash::success(Redirect::to("/"), "Login erfolgreich")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user