mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-13 20:26:52 +00:00
Restrict password login to accounts of type 'password' or legacy untyped.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
1 parent
b3a47566ff
commit
f68038a826
1 file changed
+11
@@ -65,6 +65,17 @@ pub(super) async fn password_login(
|
||||
lowercased_user_id: &UserId,
|
||||
password: &str,
|
||||
) -> 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
|
||||
.users
|
||||
.password_hash(user_id)
|
||||
|
||||
Reference in new issue
Block a user