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:
src
@ -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 {
|
||||
|
Reference in New Issue
Block a user