Skip to content

Commit

Permalink
Merge pull request #452 from dispiste/login_redirect_url
Browse files Browse the repository at this point in the history
LOGIN_REDIRECT_URL should accept an URL or named URL pattern
  • Loading branch information
akatsoulas committed May 27, 2022
2 parents 95090b1 + f932043 commit 4726127
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mozilla_django_oidc/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.http import HttpResponseRedirect, HttpResponseNotAllowed
from django.urls import reverse
from django.utils.crypto import get_random_string
from django.shortcuts import resolve_url

try:
from django.utils.http import url_has_allowed_host_and_scheme
Expand Down Expand Up @@ -40,7 +41,7 @@ def success_url(self):
# Pull the next url from the session or settings--we don't need to
# sanitize here because it should already have been sanitized.
next_url = self.request.session.get('oidc_login_next', None)
return next_url or self.get_settings('LOGIN_REDIRECT_URL', '/')
return next_url or resolve_url(self.get_settings('LOGIN_REDIRECT_URL', '/'))

def login_failure(self):
return HttpResponseRedirect(self.failure_url)
Expand Down

0 comments on commit 4726127

Please sign in to comment.