ezidam: oauth: redirect: check if user is archived
This commit is contained in:
parent
e9200f8682
commit
609933d98f
2 changed files with 9 additions and 0 deletions
|
|
@ -47,4 +47,8 @@ impl Error {
|
||||||
pub fn bad_request<M: std::fmt::Display>(value: M) -> Self {
|
pub fn bad_request<M: std::fmt::Display>(value: M) -> Self {
|
||||||
Self::new(Status::BadRequest, value)
|
Self::new(Status::BadRequest, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn forbidden<M: std::fmt::Display>(value: M) -> Self {
|
||||||
|
Self::new(Status::Forbidden, value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,11 @@ pub async fn redirect_page(
|
||||||
.await?
|
.await?
|
||||||
.ok_or_else(|| Error::not_found("Could not find user"))?;
|
.ok_or_else(|| Error::not_found("Could not find user"))?;
|
||||||
|
|
||||||
|
// Check if user is archived
|
||||||
|
if user.is_archived() {
|
||||||
|
return Err(Error::forbidden("User is archived"));
|
||||||
|
}
|
||||||
|
|
||||||
// Mark code as used
|
// Mark code as used
|
||||||
code.use_code(&mut transaction).await?;
|
code.use_code(&mut transaction).await?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue