update POST /logout error messages
This commit is contained in:
parent
2c128a1e1f
commit
68e18b89a1
|
@ -147,13 +147,13 @@ async fn login(mut db: Connection<Db>, info: Json<LoginInfo>, cookies: &CookieJa
|
|||
}
|
||||
}
|
||||
#[post("/logout")]
|
||||
async fn logout(cookies: &CookieJar<'_>) -> &'static str {
|
||||
async fn logout(cookies: &CookieJar<'_>) -> status::Custom<&'static str> {
|
||||
match cookies.get_private("token") {
|
||||
Some(_) => {
|
||||
cookies.remove_private("token");
|
||||
"Logged out."
|
||||
status::Custom(Status::Ok, "Logged out.")
|
||||
}
|
||||
None => "Not logged in.",
|
||||
None => status::Custom(Status::Unauthorized, "Not logged in."),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue