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:
parent
e01146559a
commit
33c7131be5
2 changed files with 24 additions and 1 deletions
|
@ -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.')
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue