]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/auth/oauth-model.ts
Add log on user plugin auth conflict
[github/Chocobozzz/PeerTube.git] / server / lib / auth / oauth-model.ts
index f2ef0a78af67265dc2e2ce187d2d57e9494eccd7..81b6529d8462e23157167d9cc3665d4a6247d9e0 100644 (file)
@@ -98,7 +98,14 @@ async function getUser (usernameOrEmail?: string, password?: string, bypassLogin
     // 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 !== bypassLogin.pluginName) return null
+      if (user.pluginAuth !== bypassLogin.pluginName) {
+        logger.info(
+          'Cannot bypass oauth login by plugin %s because %s has another plugin auth method (%s).',
+          bypassLogin.pluginName, bypassLogin.user.email, user.pluginAuth
+        )
+
+        return null
+      }
 
       checkUserValidityOrThrow(user)
 
@@ -226,6 +233,7 @@ async function createUserFromExternal (pluginAuth: string, options: {
     password: null,
     email: options.email,
     nsfwPolicy: CONFIG.INSTANCE.DEFAULT_NSFW_POLICY,
+    p2pEnabled: CONFIG.DEFAULTS.P2P.WEBAPP.ENABLED,
     autoPlayVideo: true,
     role: options.role,
     videoQuota: CONFIG.USER.VIDEO_QUOTA,