- // This user does not belong to this plugin, skip it
- if (user.pluginAuth !== obj.pluginName) return null
+ // Cannot create a user
+ if (!user) throw new AccessDeniedError('Cannot create such user: an actor with that name already exists.')
+
+ // If the user does not belongs to a plugin, it was created before its installation
+ // Then we just go through a regular login process
+ if (user.pluginAuth !== null) {
+ // This user does not belong to this plugin, skip it
+ if (user.pluginAuth !== obj.pluginName) return null