diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 44ef281..43d6b03 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,9 +39,12 @@ repos: rev: 1.4.0 hooks: - id: poetry-check + files: pyproject.toml - id: poetry-lock + files: pyproject.toml - id: poetry-export args: ["-f", "requirements.txt", "-o", "requirements.txt"] + files: pyproject.toml - repo: https://github.com/dhatim/python-license-check rev: 0.8.3 hooks: diff --git a/README.md b/README.md index 0ebda42..b08b91b 100644 --- a/README.md +++ b/README.md @@ -41,9 +41,23 @@ _The names of these roles can be customized in the settings below._ path('auth/', include('django_descope.urls')), ``` -1. Start the development server and visit http://127.0.0.1:8000/auth/signup +1. In your site templates, insert the `descope_flow` tag where you want to place your flow + +```html +{% load descope %} + + +{% if user.is_authenticated %} +

Welcome {{ user.email }} you are logged in!

+

Log Out

+{% else %} {% descope_flow "sign-up-or-in" "/" %} + +{% endif %} +``` + +2. Start the development server and visit http://127.0.0.1:8000/auth/signup -1. Visit http://127.0.0.1:8000/auth/tokens to see the user tokens after login +3. Visit http://127.0.0.1:8000/auth/tokens to see the user tokens after login ## Settings @@ -51,13 +65,6 @@ The following settings are available to configure in your project `settings.py` ``` DESCOPE_PROJECT_ID **Required** -DESCOPE_REQUIRE_SIGNUP - Set this to true to create user on first login -DESCOPE_LOGIN_SENT_REDIRECT -DESCOPE_LOGIN_SUCCESS_REDIRECT -DESCOPE_LOGIN_TEMPLATE_NAME -DESCOPE_LOGIN_SENT_TEMPLATE_NAME -DESCOPE_LOGIN_FAILED_TEMPLATE_NAME -DESCOPE_SIGNUP_TEMPLATE_NAME DESCOPE_IS_STAFF_ROLE DESCOPE_IS_SUPERUSER_ROLE ``` diff --git a/django_descope/views.py b/django_descope/views.py index bc0e5c9..935954a 100644 --- a/django_descope/views.py +++ b/django_descope/views.py @@ -20,7 +20,6 @@ def post(self, request: HttpRequest): session = request.POST.get(SESSION_COOKIE_NAME) refresh = request.POST.get(REFRESH_SESSION_COOKIE_NAME) if session and refresh: - # descope_client.validate_and_refresh_session(session, refresh) request.session[SESSION_COOKIE_NAME] = session request.session[REFRESH_SESSION_COOKIE_NAME] = refresh return JsonResponse({"success": True}) diff --git a/settings.py b/settings.py index 4bf1cde..21af470 100644 --- a/settings.py +++ b/settings.py @@ -139,8 +139,6 @@ }, } -LOGIN_REDIRECT_URL = "/admin" - INTERNAL_IPS = [ "127.0.0.1", ]