feat: implement session last_seen update
This commit is contained in:
parent
330877c8c5
commit
f00d842bad
4 changed files with 35 additions and 5 deletions
|
|
@ -47,10 +47,15 @@ pub async fn auth_middleware(State(ctx): State<Context>, mut req: Request, next:
|
|||
.get(SESSION_ID_COOKIE)
|
||||
.and_then(|c| c.value().parse::<i64>().ok())
|
||||
{
|
||||
let ctx_clone = ctx.clone();
|
||||
match tokio::task::spawn_blocking(move || ctx_clone.store.validate_session(session_id))
|
||||
.await
|
||||
.unwrap()
|
||||
let ctx = ctx.clone();
|
||||
match tokio::task::spawn_blocking(move || {
|
||||
let session = ctx.store.get_session(session_id)?;
|
||||
ctx.store.refresh_session(&session)?;
|
||||
|
||||
Ok(session)
|
||||
})
|
||||
.await
|
||||
.unwrap()
|
||||
{
|
||||
Ok(session) => {
|
||||
auth_user = Some(session.user);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue