Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Julien Jerphanion
Rex Dri
Commits
20433b20
Commit
20433b20
authored
Apr 24, 2018
by
Florent Chehab
Browse files
CAS infinite redirect fixed.
Redirect after login to requested page added.
parent
be0a622d
Changes
2
Hide whitespace changes
Inline
Side-by-side
general/middleware.py
View file @
20433b20
...
...
@@ -30,4 +30,4 @@ class LoginRequiredMiddleware(MiddlewareMixin):
if
not
request
.
user
.
is_authenticated
:
path
=
request
.
path_info
.
lstrip
(
'/'
)
if
not
any
(
m
.
match
(
path
)
for
m
in
EXEMPT_URLS
):
return
HttpResponseRedirect
(
settings
.
LOGIN_URL
)
return
HttpResponseRedirect
(
settings
.
LOGIN_URL
+
"?next=/"
+
path
)
general/settings.py
View file @
20433b20
...
...
@@ -44,7 +44,7 @@ MIDDLEWARE = [
'general.middleware.LoginRequiredMiddleware'
,
]
LOGIN_URL
=
'accounts/login'
LOGIN_URL
=
'
/
accounts/login'
# TODO add ignore administration
AUTHENTICATION_BACKENDS
=
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment