Commit 1fbb4084 authored by Robert Czechowski's avatar Robert Czechowski

Oauth login: Throw error instead of silently ignoring school information not...

Oauth login: Throw error instead of silently ignoring school information not being configurerd on teacher login via PMS
parent c7df4d9b
......@@ -53,6 +53,7 @@ pub enum MedalError {
CsrfCheckFailed,
SessionTimeout,
DatabaseError,
ConfigurationError,
DatabaseConnectionError,
PasswordHashingError,
UnmatchedPasswords,
......
......@@ -272,6 +272,10 @@ impl<'c, 'a, 'b> From<AugMedalError<'c, 'a, 'b>> for IronError {
IronError { error: Box::new(SessionError { message: "Database Error".to_string() }),
response: Response::with(status::InternalServerError) }
}
core::MedalError::ConfigurationError => {
IronError { error: Box::new(SessionError { message: "Server misconfiguration. Please contact an administrator!".to_string() }),
response: Response::with(status::InternalServerError) }
}
core::MedalError::DatabaseConnectionError => {
IronError { error: Box::new(SessionError { message: "Database Connection Error".to_string() }),
response: Response::with(status::InternalServerError) }
......@@ -1246,6 +1250,10 @@ fn oauth_pms(req: &mut Request, oauth_provider: OauthProvider, school_id: Option
resp.set_mut(Template::new(&"oauth_school_selector", data)).set_mut(status::Ok);
return Ok(Err(resp));
}
else {
// Configuration error:
return Err(core::MedalError::ConfigurationError);
}
}
} else if school_id.is_some() {
// A school has apparently been selected but the user is actually not a teacher
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment