Check login before logging it
This commit is contained in:
@ -18,6 +18,7 @@ use crate::data::provider::{Provider, ProvidersManager};
|
||||
use crate::data::session_identity::{SessionIdentity, SessionStatus};
|
||||
use crate::data::user::User;
|
||||
use crate::data::webauthn_manager::WebAuthManagerReq;
|
||||
use crate::utils::string_utils;
|
||||
|
||||
pub struct BaseLoginPage<'a> {
|
||||
pub danger: Option<String>,
|
||||
@ -132,6 +133,16 @@ pub async fn login_route(
|
||||
query.redirect.get_encoded()
|
||||
));
|
||||
}
|
||||
// Check if given login is not acceptable
|
||||
else if req
|
||||
.as_ref()
|
||||
.map(|r| string_utils::is_acceptable_login(&r.login))
|
||||
== Some(false)
|
||||
{
|
||||
danger = Some(
|
||||
"Given login could not be processed, because it has an invalid format!".to_string(),
|
||||
);
|
||||
}
|
||||
// Try to authenticate user
|
||||
else if let Some(req) = &req {
|
||||
login = req.login.clone();
|
||||
|
Reference in New Issue
Block a user