Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix TooLongPasswordError handling

Chocobozzz3fbf7206a1b8
diff --git a/server/core/lib/auth/oauth-user.ts b/server/core/lib/auth/oauth-user.ts
index e960fb7448..b24b582b49 100644
--- a/server/core/lib/auth/oauth-user.ts
+++ b/server/core/lib/auth/oauth-user.ts
@@ -84,6 +84,10 @@ export async function getUserOrThrow (options: {
throw new TooManyLoginFailuresError(req.t('Too many login attempts for this account. Please try again later.'))
}
+ if (isUserPasswordTooLong(password)) {
+ throw new TooLongPasswordError(req.t('Password is too long. Please reset it using the password reset procedure.'))
+ }
+
const passwordMatch = await user.isPasswordMatch(password)
if (passwordMatch !== true) {
await Redis.Instance.addLoginFailure(user.id)
@@ -91,10 +95,6 @@ export async function getUserOrThrow (options: {
throwInvalidGrantError()
}
- if (isUserPasswordTooLong(password)) {
- throw new TooLongPasswordError(req.t('Password is too long. Please reset it using the password reset procedure.'))
- }
-
checkUserNotBlockedOrThrow(user, req)
if (CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION && user.emailVerified === false) {