fix: return persistent cookies instead of session cookies
parent
bc80515474
commit
65e83ecb1f
|
@ -4,13 +4,11 @@ use axum::{
|
||||||
Router,
|
Router,
|
||||||
};
|
};
|
||||||
use axum_extra::{
|
use axum_extra::{
|
||||||
extract::{
|
extract::{cookie::Cookie, CookieJar},
|
||||||
cookie::{Cookie, Expiration},
|
|
||||||
CookieJar,
|
|
||||||
},
|
|
||||||
headers::{authorization::Basic, Authorization},
|
headers::{authorization::Basic, Authorization},
|
||||||
TypedHeader,
|
TypedHeader,
|
||||||
};
|
};
|
||||||
|
use cookie::time::Duration;
|
||||||
|
|
||||||
use crate::server::{
|
use crate::server::{
|
||||||
error::{AppError, AppResult},
|
error::{AppError, AppResult},
|
||||||
|
@ -45,7 +43,7 @@ async fn post_login(
|
||||||
.unwrap()?;
|
.unwrap()?;
|
||||||
|
|
||||||
Ok(jar.add(
|
Ok(jar.add(
|
||||||
Cookie::build((SESSION_ID_COOKIE, session.id.to_string())).expires(Expiration::Session),
|
Cookie::build((SESSION_ID_COOKIE, session.id.to_string())).max_age(Duration::days(365)),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue