what the heck was I doing here??
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Hamcha 2023-07-21 17:25:24 +02:00
parent 2342edccc1
commit 238e57e106
Signed by: hamcha
GPG key ID: 1669C533B8CF6D89

View file

@ -95,13 +95,12 @@ pub async fn refresh_sessions<B>(
{ {
let database = Database::from(&state); let database = Database::from(&state);
if let Ok(Some((session, user))) = database.find_session(session_id).await { if let Ok(Some((session, user))) = database.find_session(session_id).await {
// session validity requirements: secret must match, session must not have been expired // session validity requirements: secret must match, session must not have expired
if session.secret == session_secret && session.expires_at >= Utc::now().naive_utc() { if session.secret == session_secret && session.expires_at >= Utc::now().naive_utc() {
// in the future we might wanna change the session secret, if we do, do it here! // in the future we might wanna change the session secret, if we do, do it here!
if let Ok((session, user)) = database if let Ok(session) = database
.refresh_session(session, Duration::seconds(state.config.session_duration)) .refresh_session(session, Duration::seconds(state.config.session_duration))
.await .await
.map(|s| (s, user))
{ {
let extensions = req.extensions_mut(); let extensions = req.extensions_mut();
extensions.insert(session.clone()); extensions.insert(session.clone());