aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-01 09:24:14 +0100
committerChocobozzz <me@florianbigard.com>2021-02-01 11:23:11 +0100
commit33c7131be5883d1b25c49adbcf5750b63905a368 (patch)
tree5e5a3ed4158734b3e6f25a7eb7f20f4dc93ed6c3 /server/lib
parente01146559acd32e009ad7d399a4af151fa0d4c52 (diff)
downloadPeerTube-33c7131be5883d1b25c49adbcf5750b63905a368.tar.gz
PeerTube-33c7131be5883d1b25c49adbcf5750b63905a368.tar.zst
PeerTube-33c7131be5883d1b25c49adbcf5750b63905a368.zip
Check banned status for external auths
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/oauth-model.ts8
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
244function checkUserValidityOrThrow (user: MUser) {
245 if (user.blocked) throw new AccessDeniedError('User is blocked.')
246}