Restrict password login to accounts of type 'password' or legacy untyped.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -65,6 +65,17 @@ pub(super) async fn password_login(
|
|||||||
lowercased_user_id: &UserId,
|
lowercased_user_id: &UserId,
|
||||||
password: &str,
|
password: &str,
|
||||||
) -> Result<OwnedUserId> {
|
) -> Result<OwnedUserId> {
|
||||||
|
// Restrict login to accounts only of type 'password', including untyped
|
||||||
|
// legacy accounts which are equivalent to 'password'.
|
||||||
|
if services
|
||||||
|
.users
|
||||||
|
.origin(user_id)
|
||||||
|
.await
|
||||||
|
.is_ok_and(|origin| origin != "password")
|
||||||
|
{
|
||||||
|
return Err!(Request(Forbidden("Account does not permit password login.")));
|
||||||
|
}
|
||||||
|
|
||||||
let (hash, user_id) = services
|
let (hash, user_id) = services
|
||||||
.users
|
.users
|
||||||
.password_hash(user_id)
|
.password_hash(user_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user