diff --git a/src/tera/auth.rs b/src/tera/auth.rs index 90edcbc..cfe294d 100644 --- a/src/tera/auth.rs +++ b/src/tera/auth.rs @@ -66,11 +66,6 @@ async fn login( cookies: &CookieJar<'_>, agent: UserAgent, ) -> Flash { - Log::create( - db, - format!("{} has this useragent: {:?}", login.name, agent), - ) - .await; let user = match User::login(db, login.name, login.password).await { Ok(user) => user, Err(LoginError::NoPasswordSet(user)) => { @@ -87,6 +82,15 @@ async fn login( let user_json: String = format!("{}", json!(user)); 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") }