fix 308 to 303,solve redirection problem
This commit is contained in:
parent
168619ef63
commit
5df82f7a8f
@ -94,7 +94,7 @@ async fn auth(
|
|||||||
return StatusCode::UNAUTHORIZED;
|
return StatusCode::UNAUTHORIZED;
|
||||||
};
|
};
|
||||||
let mut locked = state.session.lock().await;
|
let mut locked = state.session.lock().await;
|
||||||
if locked.contains_key(&s) { // FIX
|
if locked.contains_key(&s) { // FIX, when accessed /auth with correct cookie, the cookie's expiration is delayed
|
||||||
let Some(v) = locked.insert(s,Instant::now()+Duration::from_secs(SESSION_ACTIVE_TIME)) else {
|
let Some(v) = locked.insert(s,Instant::now()+Duration::from_secs(SESSION_ACTIVE_TIME)) else {
|
||||||
return StatusCode::UNAUTHORIZED;
|
return StatusCode::UNAUTHORIZED;
|
||||||
};
|
};
|
||||||
@ -134,7 +134,7 @@ async fn login(
|
|||||||
locked.insert(s.clone(), Instant::now() + Duration::from_secs(SESSION_ACTIVE_TIME));
|
locked.insert(s.clone(), Instant::now() + Duration::from_secs(SESSION_ACTIVE_TIME));
|
||||||
cookies.add(Cookie::new(COOKIE_NAME, s.to_string()));
|
cookies.add(Cookie::new(COOKIE_NAME, s.to_string()));
|
||||||
if let Some(original_uri) = params.get("original_url") {
|
if let Some(original_uri) = params.get("original_url") {
|
||||||
return Ok(Redirect::permanent(&original_uri));
|
return Ok(Redirect::to(&original_uri));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Err((StatusCode::ACCEPTED, "ok"));
|
return Err((StatusCode::ACCEPTED, "ok"));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user