mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-25 23:43:18 +00:00
* Return status 401 on logout with invalid auth (fixes #4081) * format
This commit is contained in:
parent
ec0a707110
commit
6235ff45b5
|
@ -56,6 +56,9 @@ impl Display for LemmyError {
|
||||||
|
|
||||||
impl actix_web::error::ResponseError for LemmyError {
|
impl actix_web::error::ResponseError for LemmyError {
|
||||||
fn status_code(&self) -> http::StatusCode {
|
fn status_code(&self) -> http::StatusCode {
|
||||||
|
if self.error_type == LemmyErrorType::IncorrectLogin {
|
||||||
|
return http::StatusCode::UNAUTHORIZED;
|
||||||
|
}
|
||||||
match self.inner.downcast_ref::<diesel::result::Error>() {
|
match self.inner.downcast_ref::<diesel::result::Error>() {
|
||||||
Some(diesel::result::Error::NotFound) => http::StatusCode::NOT_FOUND,
|
Some(diesel::result::Error::NotFound) => http::StatusCode::NOT_FOUND,
|
||||||
_ => http::StatusCode::BAD_REQUEST,
|
_ => http::StatusCode::BAD_REQUEST,
|
||||||
|
|
Loading…
Reference in a new issue