forked from Plume/Plume
Implement logout
This commit is contained in:
parent
00e5f28d0b
commit
4f9df753f5
2 changed files with 8 additions and 0 deletions
|
@ -60,6 +60,7 @@ fn main() {
|
|||
|
||||
routes::session::new,
|
||||
routes::session::create,
|
||||
routes::session::delete,
|
||||
|
||||
routes::blogs::details,
|
||||
routes::blogs::new,
|
||||
|
|
|
@ -43,3 +43,10 @@ fn create(conn: DbConn, data: Form<LoginForm>, mut cookies: Cookies) -> Result<R
|
|||
Err(e) => Err(NotFound(String::from(e)))
|
||||
}
|
||||
}
|
||||
|
||||
#[get("/logout")]
|
||||
fn delete(mut cookies: Cookies) -> Redirect {
|
||||
let cookie = cookies.get_private(AUTH_COOKIE).unwrap();
|
||||
cookies.remove_private(cookie);
|
||||
Redirect::to("/")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue