소스 검색

Option to disable Org 2FA for Plex Auth login (FR#103)

CauseFX 4 년 전
부모
커밋
a2a3a3303f
2개의 변경된 파일21개의 추가작업 그리고 3개의 파일을 삭제
  1. 20 3
      api/classes/organizr.class.php
  2. 1 0
      api/config/default.php

+ 20 - 3
api/classes/organizr.class.php

@@ -2346,6 +2346,14 @@ class Organizr
 					'class' => 'plexAuth switchAuth',
 					'value' => $this->config['plexoAuth']
 				),
+				array(
+					'type' => 'switch',
+					'name' => 'ignoreTFAIfPlexOAuth',
+					'label' => 'Ignore 2FA if Plex OAuth ',
+					'class' => 'plexAuth switchAuth',
+					'value' => $this->config['ignoreTFAIfPlexOAuth'],
+					'help' => 'Enabling this will disable Organizr 2FA (If applicable) if User uses Plex OAuth to login'
+				),
 				array(
 					'type' => 'switch',
 					'name' => 'plexStrictFriends',
@@ -3792,7 +3800,8 @@ class Organizr
 								'username' => $tokenInfo['user']['username'],
 								'email' => $tokenInfo['user']['email'],
 								'image' => $tokenInfo['user']['thumb'],
-								'token' => $tokenInfo['user']['authToken']
+								'token' => $tokenInfo['user']['authToken'],
+								'oauth' => 'plex'
 							);
 							$this->coookie('set', 'oAuth', 'true', $this->config['rememberMeDays']);
 							$authSuccess = ((!empty($this->config['plexAdmin']) && strtolower($this->config['plexAdmin']) == strtolower($tokenInfo['user']['username'])) || (!empty($this->config['plexAdmin']) && strtolower($this->config['plexAdmin']) == strtolower($tokenInfo['user']['email'])) || $this->checkPlexUser($tokenInfo['user']['username'])) ? $authSuccess : false;
@@ -3836,7 +3845,15 @@ class Organizr
 					$tfaProceed = true;
 					// Add check for local or not
 					if ($this->config['ignoreTFALocal'] !== false) {
-						$tfaProceed = ($this->isLocal()) ? false : true;
+						$tfaProceed = !$this->isLocal();
+					}
+					// Is Plex Oauth?
+					if ($this->config['ignoreTFAIfPlexOAuth'] !== false) {
+						if (isset($authSuccess['oauth'])) {
+							if ($authSuccess['oauth'] == 'plex') {
+								$tfaProceed = false;
+							}
+						}
 					}
 					if ($tfaProceed) {
 						$TFA = explode('::', $result['auth_service']);
@@ -4814,7 +4831,7 @@ class Organizr
 						if ($item['type'] !== 'html' && $item['type'] !== 'blank' && $item['type'] !== 'button') {
 							if ((stripos($item['name'], 'token') !== false) || (stripos($item['name'], 'key') !== false) || (stripos($item['name'], 'password'))) {
 								if ($item['value'] !== '') {
-									$item['value'] = '**********';
+									$item['value'] = '***redacted***';
 								}
 							}
 							$debug[$category][$item['name']] = $item['value'];

+ 1 - 0
api/config/default.php

@@ -404,6 +404,7 @@ return [
 	'rememberMeDays' => '7',
 	'rememberMe' => true,
 	'plexStrictFriends' => true,
+	'ignoreTFAIfPlexOAuth' => false,
 	'debugAreaAuth' => '1',
 	'commit' => 'n/a',
 	'ombiLimit' => '50',