Skip to content

Commit

Permalink
Added OAuth Login Providers
Browse files Browse the repository at this point in the history
  • Loading branch information
mkumar-02 committed Mar 29, 2024
1 parent 2f24f33 commit 8a1e6d4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 55 deletions.
10 changes: 1 addition & 9 deletions g2p_self_service_portal/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
"views/g2p_self_service_aboutus.xml",
"views/g2p_self_service_otherpage.xml",
"views/g2p_self_service_contactus.xml",
# TODO: The 'auth_oidc' module was removed; a replacement is needed in the code
# "views/auth_oauth_provider.xml",
"views/g2p_self_service_form_page_template.xml",
"views/program_view.xml",
"views/g2p_self_service_signup.xml",
Expand All @@ -42,15 +40,9 @@
],
"assets": {
"web.assets_backend": [],
"web.assets_qweb": [
# "views/g2p_self_service_portal.doughnut_chart.xml",
],
"web.assets_qweb": [],
"web.assets_frontend": [
"g2p_self_service_portal/static/src/js/self_service_form_action.js",
# # "g2p_self_service_portal/static/src/js/self_service_pie_chart.js",
# "g2p_self_service_portal/static/src/js/self_service_search_sort.js",
# "g2p_self_service_portal/static/src/js/self_service_search_sort_all.js",
# "g2p_self_service_portal/static/src/js/self_service_welcome_alert.js"
],
"web.assets_common": [],
},
Expand Down
18 changes: 9 additions & 9 deletions g2p_self_service_portal/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
from odoo.http import request
from odoo.tools import safe_eval

# TODO: The 'auth_oidc' module was removed; a replacement is needed in the code
# from odoo.addons.auth_oidc.controllers.main import OpenIDLogin
from odoo.addons.auth_oauth.controllers.main import OAuthLogin
from odoo.addons.auth_signup.controllers.main import AuthSignupHome
from odoo.addons.web.controllers.main import Home

Expand All @@ -34,13 +33,14 @@ def self_service_login(self, **kwargs):
context = {}

providers = []
# TODO: The 'auth_oidc' module was removed; a replacement is needed in the code
# try:
# providers = OpenIDLogin().list_providers(
# domain=[("g2p_self_service_allowed", "=", True)]
# )
# except Exception:
# providers = OpenIDLogin().list_providers()
try:
providers = [
p
for p in OAuthLogin().list_providers()
if p.get("g2p_self_service_allowed", True)
]
except Exception:
providers = OAuthLogin().list_providers()

context.update(dict(providers=providers))

Expand Down
14 changes: 0 additions & 14 deletions g2p_self_service_portal/views/auth_oauth_provider.xml

This file was deleted.

18 changes: 9 additions & 9 deletions g2p_service_provider_portal/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
from odoo import _, http
from odoo.http import request

# TODO: The 'auth_oidc' module was removed; a replacement is needed in the code
# from odoo.addons.auth_oidc.controllers.main import OpenIDLogin
from odoo.addons.auth_oauth.controllers.main import OAuthLogin
from odoo.addons.g2p_self_service_portal.controllers.main import SelfServiceController
from odoo.addons.web.controllers.main import Home

Expand All @@ -33,13 +32,14 @@ def service_provider_login(self, **kwargs):

providers = []

# TODO: The 'auth_oidc' module was removed; a replacement is needed in the code
# try:
# providers = OpenIDLogin().list_providers(
# domain=[("g2p_service_provider_allowed", "=", True)]
# )
# except Exception:
# providers = OpenIDLogin().list_providers()
try:
providers = [
p
for p in OAuthLogin().list_providers()
if p.get("g2p_service_provider_allowed", True)
]
except Exception:
providers = OAuthLogin().list_providers()

context.update(dict(providers=providers))
if request.httprequest.method == "POST":
Expand Down
14 changes: 0 additions & 14 deletions g2p_service_provider_portal/views/auth_oauth_provider.xml

This file was deleted.

0 comments on commit 8a1e6d4

Please sign in to comment.