fixed location of lowercase fn
This commit is contained in:
parent
9385ea0e7c
commit
8bafdc4623
1 changed files with 6 additions and 6 deletions
|
@ -52,15 +52,15 @@ pub async fn login_route(
|
||||||
password,
|
password,
|
||||||
}) => {
|
}) => {
|
||||||
let username = if let IncomingUserIdentifier::MatrixId(matrix_id) = identifier {
|
let username = if let IncomingUserIdentifier::MatrixId(matrix_id) = identifier {
|
||||||
matrix_id
|
matrix_id.to_lowercase()
|
||||||
} else {
|
} else {
|
||||||
return Err(Error::BadRequest(ErrorKind::Forbidden, "Bad login type."));
|
return Err(Error::BadRequest(ErrorKind::Forbidden, "Bad login type."));
|
||||||
};
|
};
|
||||||
let user_id = UserId::parse_with_server_name(
|
let user_id =
|
||||||
username.to_lowercase().to_owned(),
|
UserId::parse_with_server_name(username.to_owned(), db.globals.server_name())
|
||||||
db.globals.server_name(),
|
.map_err(|_| {
|
||||||
)
|
Error::BadRequest(ErrorKind::InvalidUsername, "Username is invalid.")
|
||||||
.map_err(|_| Error::BadRequest(ErrorKind::InvalidUsername, "Username is invalid."))?;
|
})?;
|
||||||
let hash = db.users.password_hash(&user_id)?.ok_or(Error::BadRequest(
|
let hash = db.users.password_hash(&user_id)?.ok_or(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::Forbidden,
|
||||||
"Wrong username or password.",
|
"Wrong username or password.",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue