mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fix the following SonarQube code smells:
1) Use the "RegExp.exec()" method instead. 2) Remove parameter form or provide default value. 3) Extract this nested ternary operation into an independent statement. 4) Replace this character class by the character itself. 5) Unnecessary use of conditional expression for default assignment. 6) Prefer using an optional chain expression instead, as it's more concise and easier to read.
This commit is contained in:
@@ -41,7 +41,7 @@ class BaseAuthentication(metaclass=AuthSourceRegistry):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def authenticate(self):
|
||||
def authenticate(self, form):
|
||||
pass
|
||||
|
||||
def validate(self, form):
|
||||
|
||||
@@ -27,7 +27,6 @@ from pgadmin.utils.constants import KERBEROS, MessageType
|
||||
from pgadmin.utils import PgAdminModule
|
||||
from pgadmin.utils.ajax import make_json_response, internal_server_error
|
||||
|
||||
|
||||
from pgadmin.authenticate.internal import BaseAuthentication
|
||||
from pgadmin.authenticate import get_auth_sources
|
||||
from pgadmin.utils.csrf import pgCSRFProtect
|
||||
|
||||
@@ -275,6 +275,6 @@ class OAuth2Authentication(BaseAuthentication):
|
||||
authorized_claims = [authorized_claims]
|
||||
if any(item in authorized_claims for item in claim):
|
||||
reason = "Claim match found. Authorized access."
|
||||
return (True, reason)
|
||||
reason = f"No match was found."
|
||||
return (False, reason)
|
||||
return True, reason
|
||||
reason = "No match was found."
|
||||
return False, reason
|
||||
|
||||
Reference in New Issue
Block a user