Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jelle van der Waa
Archweb
Commits
6ee7a936
Commit
6ee7a936
authored
Dec 26, 2007
by
eliott
Browse files
initial stab at an authentication middleware
parent
6226b02f
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/sitelogin.py
0 → 100644
View file @
6ee7a936
from
django.contrib.auth.views
import
logout_then_login
,
login
from
django.conf
import
settings
class
SiteLogin
:
def
__init__
(
self
):
self
.
login_path
=
settings
.
LOGIN_URL
def
process_request
(
self
,
request
):
if
request
.
user
.
is_anonymous
()
and
request
.
path
!=
self
.
login_path
:
if
request
.
POST
:
return
login
(
request
)
else
:
return
HttpResponseRedirect
(
'%s?next=%s'
%
(
self
.
login_path
,
request
.
path
))
settings.py
View file @
6ee7a936
...
...
@@ -40,6 +40,9 @@
# URL to send users when they don't have sufficient privileges
BADPRIVS_URL
=
'/denied/'
# login url
LOGIN_URL
=
'/login/'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS
=
(
'django.template.loaders.filesystem.load_template_source'
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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