1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2024-09-12 01:29:12 +02:00

fixed location of lowercase fn

This commit is contained in:
reti4 2022-03-02 02:25:15 +00:00
parent 9385ea0e7c
commit 8bafdc4623

View file

@ -52,15 +52,15 @@ pub async fn login_route(
password,
}) => {
let username = if let IncomingUserIdentifier::MatrixId(matrix_id) = identifier {
matrix_id
matrix_id.to_lowercase()
} else {
return Err(Error::BadRequest(ErrorKind::Forbidden, "Bad login type."));
};
let user_id = UserId::parse_with_server_name(
username.to_lowercase().to_owned(),
db.globals.server_name(),
)
.map_err(|_| Error::BadRequest(ErrorKind::InvalidUsername, "Username is invalid."))?;
let user_id =
UserId::parse_with_server_name(username.to_owned(), db.globals.server_name())
.map_err(|_| {
Error::BadRequest(ErrorKind::InvalidUsername, "Username is invalid.")
})?;
let hash = db.users.password_hash(&user_id)?.ok_or(Error::BadRequest(
ErrorKind::Forbidden,
"Wrong username or password.",