1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-07-14 03:18:05 +00:00

Can check the validity of a password reset token

This commit is contained in:
2020-07-13 14:52:25 +02:00
parent e4b361ab12
commit 8a2f482bbd
5 changed files with 50 additions and 3 deletions

@ -156,6 +156,18 @@ impl HttpRequestHandler {
}
}
/// If result is not OK, return a bad request
pub fn ok_or_forbidden<E>(&mut self, res: ResultBoxError<E>, msg: &str) -> ResultBoxError<E> {
match res {
Ok(e) => Ok(e),
Err(err) => {
println!("Error leading to access forbidden: {}", err);
self.forbidden(msg.to_string())?;
unreachable!()
}
}
}
/// If result is not OK, return a 404 not found error
pub fn ok_or_not_found<E>(&mut self, res: ResultBoxError<E>, msg: &str) -> ResultBoxError<E> {
match res {