snapshot of https://github.com/frappe/crm.git (develop, 2026-09-18; blobs > 131072B omitted)
Some checks failed
Frontend / Unit Tests & Coverage (push) Has been skipped
Regenerate POT file (translatable strings) / Regenerate POT file (develop) (push) Failing after 1m13s
Regenerate POT file (translatable strings) / Regenerate POT file (main-hotfix) (push) Failing after 6s
Server / Tests (frappe ${{ matrix.frappe-branch }}) (push) Has been skipped
Server / Resolve frappe matrix (push) Failing after 1s
Frontend / Lint (push) Failing after 1s
Frontend / Production Build (push) Failing after 1s
Server / Coverage Wrap Up (push) Has been skipped
Frontend / Coverage Wrap Up (push) Has been skipped
Some checks failed
Frontend / Unit Tests & Coverage (push) Has been skipped
Regenerate POT file (translatable strings) / Regenerate POT file (develop) (push) Failing after 1m13s
Regenerate POT file (translatable strings) / Regenerate POT file (main-hotfix) (push) Failing after 6s
Server / Tests (frappe ${{ matrix.frappe-branch }}) (push) Has been skipped
Server / Resolve frappe matrix (push) Failing after 1s
Frontend / Lint (push) Failing after 1s
Frontend / Production Build (push) Failing after 1s
Server / Coverage Wrap Up (push) Has been skipped
Frontend / Coverage Wrap Up (push) Has been skipped
This commit is contained in:
39
crm/api/auth.py
Normal file
39
crm/api/auth.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import frappe
|
||||
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def oauth_providers():
|
||||
from frappe.utils.html_utils import get_icon_html
|
||||
from frappe.utils.oauth import get_oauth2_authorize_url, get_oauth_keys
|
||||
from frappe.utils.password import get_decrypted_password
|
||||
|
||||
out = []
|
||||
providers = frappe.get_all(
|
||||
"Social Login Key",
|
||||
filters={"enable_social_login": 1},
|
||||
fields=["name", "client_id", "base_url", "provider_name", "icon"],
|
||||
order_by="name",
|
||||
)
|
||||
|
||||
for provider in providers:
|
||||
client_secret = get_decrypted_password("Social Login Key", provider.name, "client_secret")
|
||||
if not client_secret:
|
||||
continue
|
||||
|
||||
icon = None
|
||||
if provider.icon:
|
||||
if provider.provider_name == "Custom":
|
||||
icon = get_icon_html(provider.icon, small=True)
|
||||
else:
|
||||
icon = f"<img src='{provider.icon}' alt={provider.provider_name}>"
|
||||
|
||||
if provider.client_id and provider.base_url and get_oauth_keys(provider.name):
|
||||
out.append(
|
||||
{
|
||||
"name": provider.name,
|
||||
"provider_name": provider.provider_name,
|
||||
"auth_url": get_oauth2_authorize_url(provider.name, "/crm"),
|
||||
"icon": icon,
|
||||
}
|
||||
)
|
||||
return out
|
||||
Reference in New Issue
Block a user