diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/oauth-model.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/server/lib/oauth-model.ts b/server/lib/oauth-model.ts index f7ea98b41..3f8b8e618 100644 --- a/server/lib/oauth-model.ts +++ b/server/lib/oauth-model.ts | |||
@@ -119,6 +119,8 @@ async function getUser (usernameOrEmail?: string, password?: string) { | |||
119 | // This user does not belong to this plugin, skip it | 119 | // This user does not belong to this plugin, skip it |
120 | if (user.pluginAuth !== obj.pluginName) return null | 120 | if (user.pluginAuth !== obj.pluginName) return null |
121 | 121 | ||
122 | checkUserValidityOrThrow(user) | ||
123 | |||
122 | return user | 124 | return user |
123 | } | 125 | } |
124 | } | 126 | } |
@@ -132,7 +134,7 @@ async function getUser (usernameOrEmail?: string, password?: string) { | |||
132 | const passwordMatch = await user.isPasswordMatch(password) | 134 | const passwordMatch = await user.isPasswordMatch(password) |
133 | if (passwordMatch !== true) return null | 135 | if (passwordMatch !== true) return null |
134 | 136 | ||
135 | if (user.blocked) throw new AccessDeniedError('User is blocked.') | 137 | checkUserValidityOrThrow(user) |
136 | 138 | ||
137 | if (CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION && user.emailVerified === false) { | 139 | if (CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION && user.emailVerified === false) { |
138 | throw new AccessDeniedError('User email is not verified.') | 140 | throw new AccessDeniedError('User email is not verified.') |
@@ -238,3 +240,7 @@ async function createUserFromExternal (pluginAuth: string, options: { | |||
238 | 240 | ||
239 | return user | 241 | return user |
240 | } | 242 | } |
243 | |||
244 | function checkUserValidityOrThrow (user: MUser) { | ||
245 | if (user.blocked) throw new AccessDeniedError('User is blocked.') | ||
246 | } | ||