Implement logout
This commit is contained in:
parent
00e5f28d0b
commit
4f9df753f5
|
@ -60,6 +60,7 @@ fn main() {
|
||||||
|
|
||||||
routes::session::new,
|
routes::session::new,
|
||||||
routes::session::create,
|
routes::session::create,
|
||||||
|
routes::session::delete,
|
||||||
|
|
||||||
routes::blogs::details,
|
routes::blogs::details,
|
||||||
routes::blogs::new,
|
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)))
|
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 New Issue