feat: logout button
This commit is contained in:
parent
2f5cc33261
commit
76b0d70a01
@ -29,6 +29,7 @@ pub fn init(cfg: &mut ServiceConfig) {
|
|||||||
cfg.service(user::post_edit::post_edit);
|
cfg.service(user::post_edit::post_edit);
|
||||||
cfg.service(user::patch::patch);
|
cfg.service(user::patch::patch);
|
||||||
cfg.service(user::delete::delete);
|
cfg.service(user::delete::delete);
|
||||||
|
cfg.service(user::get_logout::get);
|
||||||
|
|
||||||
cfg.service(events::get_new::get);
|
cfg.service(events::get_new::get);
|
||||||
cfg.service(events::post_new::post);
|
cfg.service(events::post_new::post);
|
||||||
|
10
src/endpoints/user/get_logout.rs
Normal file
10
src/endpoints/user/get_logout.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
use actix_identity::Identity;
|
||||||
|
use actix_web::{http::header::LOCATION, HttpResponse, Responder};
|
||||||
|
|
||||||
|
|
||||||
|
#[actix_web::get("/logout")]
|
||||||
|
pub async fn get(user: Identity) -> impl Responder {
|
||||||
|
user.logout();
|
||||||
|
|
||||||
|
HttpResponse::Found().insert_header((LOCATION, "/")).finish()
|
||||||
|
}
|
@ -5,3 +5,4 @@ pub mod get_edit;
|
|||||||
pub mod post_edit;
|
pub mod post_edit;
|
||||||
pub mod patch;
|
pub mod patch;
|
||||||
pub mod delete;
|
pub mod delete;
|
||||||
|
pub mod get_logout;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<div class="navbar-menu">
|
<div class="navbar-menu">
|
||||||
<div class="navbar-start">
|
<div class="navbar-start">
|
||||||
<a class="navbar-item">
|
<a href="/" class="navbar-item">
|
||||||
Kalender
|
Kalender
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@ -52,7 +52,7 @@
|
|||||||
<a class="button is-primary">
|
<a class="button is-primary">
|
||||||
Profil
|
Profil
|
||||||
</a>
|
</a>
|
||||||
<a class="button is-light">
|
<a href="/logout" class="button is-light">
|
||||||
Abmelden
|
Abmelden
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user