fix proper loggedin_user cookie after setting pw

This commit is contained in:
philipp 2023-10-13 09:43:59 +02:00
parent 3e327e98f1
commit fa3ab3ec8a

View File

@ -79,7 +79,7 @@ async fn login(
} }
}; };
cookies.add_private(Cookie::new("loggedin_user", format!("{}", json!(user.id)))); cookies.add_private(Cookie::new("loggedin_user", format!("{}", user.id)));
Log::create( Log::create(
db, db,
@ -128,8 +128,7 @@ async fn updatepw(
user.update_pw(db, updatepw.password).await; user.update_pw(db, updatepw.password).await;
let user_json: String = format!("{}", json!(user)); let mut cookie = Cookie::new("loggedin_user", format!("{}", user.id));
let mut cookie = Cookie::new("loggedin_user", user_json);
cookie.set_expires(OffsetDateTime::now_utc() + Duration::weeks(12)); cookie.set_expires(OffsetDateTime::now_utc() + Duration::weeks(12));
cookies.add_private(cookie); cookies.add_private(cookie);