Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

[WEB - 1827]remove: migration for account and social login connection (#5013)

Nikhilc8491a13b330
diff --git a/apiserver/plane/authentication/adapter/oauth.py b/apiserver/plane/authentication/adapter/oauth.py
index 1878126d90..ffda0212f2 100644
--- a/apiserver/plane/authentication/adapter/oauth.py
+++ b/apiserver/plane/authentication/adapter/oauth.py
@@ -39,6 +39,16 @@ class OauthAdapter(Adapter):
self.client_secret = client_secret
self.code = code
+ def authentication_error_code(self):
+ if self.provider == "google":
+ return "GOOGLE_OAUTH_PROVIDER_ERROR"
+ elif self.provider == "github":
+ return "GITHUB_OAUTH_PROVIDER_ERROR"
+ elif self.provider == "gitlab":
+ return "GITLAB_OAUTH_PROVIDER_ERROR"
+ else:
+ return "OAUTH_NOT_CONFIGURED"
+
def get_auth_url(self):
return self.auth_url
@@ -62,7 +72,7 @@ class OauthAdapter(Adapter):
response.raise_for_status()
return response.json()
except requests.RequestException:
- code = self._provider_error_code()
+ code = self.authentication_error_code()
raise AuthenticationException(
error_code=AUTHENTICATION_ERROR_CODES[code],
error_message=str(code),
@@ -77,15 +87,7 @@ class OauthAdapter(Adapter):
response.raise_for_status()
return response.json()
except requests.RequestException:
- if self.provider == "google":
- code = "GOOGLE_OAUTH_PROVIDER_ERROR"
- elif self.provider == "github":
- code = "GITHUB_OAUTH_PROVIDER_ERROR"
- elif self.provider == "gitlab":
- code = "GITLAB_OAUTH_PROVIDER_ERROR"
- else:
- code = "OAUTH_NOT_CONFIGURED"
-
+ code = self.authentication_error_code()
raise AuthenticationException(
error_code=AUTHENTICATION_ERROR_CODES[code],
error_message=str(code),