From 4291a5b97d0ab0043dffbb72099e7e8c6b7979dc Mon Sep 17 00:00:00 2001 From: Herculino Trotta Date: Mon, 16 Jun 2025 22:20:10 -0300 Subject: [PATCH] feat: allow only social auth with django-allauth --- app/WYGIWYH/settings.py | 6 +++--- app/WYGIWYH/urls.py | 10 +++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/WYGIWYH/settings.py b/app/WYGIWYH/settings.py index 67c47ff..79d3e89 100644 --- a/app/WYGIWYH/settings.py +++ b/app/WYGIWYH/settings.py @@ -346,12 +346,12 @@ if ( ACCOUNT_LOGIN_METHODS = {"email"} ACCOUNT_SIGNUP_FIELDS = ["email*", "password1*", "password2*"] ACCOUNT_USER_MODEL_USERNAME_FIELD = None -ACCOUNT_EMAIL_VERIFICATION = "optional" -SOCIALACCOUNT_ADAPTER = "allauth.socialaccount.adapter.DefaultSocialAccountAdapter" +ACCOUNT_EMAIL_VERIFICATION = "none" SOCIALACCOUNT_LOGIN_ON_GET = True +SOCIALACCOUNT_ONLY = True SOCIALACCOUNT_AUTO_SIGNUP = os.getenv("OIDC_ALLOW_SIGNUP", "true").lower() == "true" ACCOUNT_ADAPTER = "allauth.account.adapter.DefaultAccountAdapter" - +SOCIALACCOUNT_ADAPTER = "allauth.socialaccount.adapter.DefaultSocialAccountAdapter" # CRISPY FORMS CRISPY_ALLOWED_TEMPLATE_PACKS = ["bootstrap5", "crispy_forms/pure_text"] diff --git a/app/WYGIWYH/urls.py b/app/WYGIWYH/urls.py index c60c519..f0294ee 100644 --- a/app/WYGIWYH/urls.py +++ b/app/WYGIWYH/urls.py @@ -21,6 +21,8 @@ from drf_spectacular.views import ( SpectacularAPIView, SpectacularSwaggerView, ) +from allauth.socialaccount.providers.openid_connect.views import login, callback + urlpatterns = [ path("admin/", admin.site.urls), @@ -36,7 +38,13 @@ urlpatterns = [ SpectacularSwaggerView.as_view(url_name="schema"), name="swagger-ui", ), - path("daa/accounts/", include("allauth.urls")), # allauth urls + path("auth/", include("allauth.urls")), # allauth urls + # path("auth/oidc//login/", login, name="openid_connect_login"), + # path( + # "auth/oidc//login/callback/", + # callback, + # name="openid_connect_callback", + # ), path("", include("apps.transactions.urls")), path("", include("apps.common.urls")), path("", include("apps.users.urls")),