diff options
Diffstat (limited to 'server/lib/oauth-model.ts')
-rw-r--r-- | server/lib/oauth-model.ts | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/server/lib/oauth-model.ts b/server/lib/oauth-model.ts index 8d8a6d85e..136abd0c4 100644 --- a/server/lib/oauth-model.ts +++ b/server/lib/oauth-model.ts | |||
@@ -109,10 +109,14 @@ async function getUser (usernameOrEmail?: string, password?: string) { | |||
109 | let user = await UserModel.loadByEmail(obj.user.email) | 109 | let user = await UserModel.loadByEmail(obj.user.email) |
110 | if (!user) user = await createUserFromExternal(obj.pluginName, obj.user) | 110 | if (!user) user = await createUserFromExternal(obj.pluginName, obj.user) |
111 | 111 | ||
112 | // This user does not belong to this plugin, skip it | 112 | // If the user does not belongs to a plugin, it was created before its installation |
113 | if (user.pluginAuth !== obj.pluginName) return null | 113 | // Then we just go through a regular login process |
114 | if (user.pluginAuth !== null) { | ||
115 | // This user does not belong to this plugin, skip it | ||
116 | if (user.pluginAuth !== obj.pluginName) return null | ||
114 | 117 | ||
115 | return user | 118 | return user |
119 | } | ||
116 | } | 120 | } |
117 | 121 | ||
118 | logger.debug('Getting User (username/email: ' + usernameOrEmail + ', password: ******).') | 122 | logger.debug('Getting User (username/email: ' + usernameOrEmail + ', password: ******).') |
@@ -122,7 +126,7 @@ async function getUser (usernameOrEmail?: string, password?: string) { | |||
122 | if (!user || user.pluginAuth !== null) return null | 126 | if (!user || user.pluginAuth !== null) return null |
123 | 127 | ||
124 | const passwordMatch = await user.isPasswordMatch(password) | 128 | const passwordMatch = await user.isPasswordMatch(password) |
125 | if (passwordMatch === false) return null | 129 | if (passwordMatch !== true) return null |
126 | 130 | ||
127 | if (user.blocked) throw new AccessDeniedError('User is blocked.') | 131 | if (user.blocked) throw new AccessDeniedError('User is blocked.') |
128 | 132 | ||