1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 17:59:37 +02:00

Check banned status for external auths

This commit is contained in:
Chocobozzz 2021-02-01 09:24:14 +01:00
parent e01146559a
commit 33c7131be5
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 24 additions and 1 deletions

View file

@ -119,6 +119,8 @@ async function getUser (usernameOrEmail?: string, password?: string) {
// This user does not belong to this plugin, skip it
if (user.pluginAuth !== obj.pluginName) return null
checkUserValidityOrThrow(user)
return user
}
}
@ -132,7 +134,7 @@ async function getUser (usernameOrEmail?: string, password?: string) {
const passwordMatch = await user.isPasswordMatch(password)
if (passwordMatch !== true) return null
if (user.blocked) throw new AccessDeniedError('User is blocked.')
checkUserValidityOrThrow(user)
if (CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION && user.emailVerified === false) {
throw new AccessDeniedError('User email is not verified.')
@ -238,3 +240,7 @@ async function createUserFromExternal (pluginAuth: string, options: {
return user
}
function checkUserValidityOrThrow (user: MUser) {
if (user.blocked) throw new AccessDeniedError('User is blocked.')
}