17 lines
527 B
Rust
17 lines
527 B
Rust
use rocket::response::Redirect;
|
|
use rocket::Request;
|
|
|
|
/// Catches all 401 errors and redirects to front page to show error
|
|
/// Will be called when session cookies are invalid
|
|
#[catch(401)]
|
|
pub fn unauthorized() -> Redirect {
|
|
Redirect::to("/?error=unauthorized")
|
|
}
|
|
|
|
/// Catches all 403 errors and redirects to main portal page to show error
|
|
/// Will be called when member tries to access module/action without required permissions
|
|
#[catch(403)]
|
|
pub fn forbidden() -> Redirect {
|
|
Redirect::to("/portal?error=forbidden")
|
|
}
|