Nekrocuck
This commit is contained in:
13
src/web/logout.rs
Normal file
13
src/web/logout.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
use actix_web::{cookie::Cookie, get, http::StatusCode, HttpResponse, HttpResponseBuilder};
|
||||
|
||||
#[get("/logout")]
|
||||
pub async fn logout() -> HttpResponse {
|
||||
let mut auth = Cookie::named("auth");
|
||||
|
||||
auth.make_removal();
|
||||
|
||||
HttpResponseBuilder::new(StatusCode::SEE_OTHER)
|
||||
.append_header(("Location", "/"))
|
||||
.cookie(auth)
|
||||
.finish()
|
||||
}
|
||||
Reference in New Issue
Block a user