mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Removed Nexus, switched to default backends
This commit is contained in:
@@ -63,7 +63,6 @@ INSTALLED_APPS = (
|
||||
'django.contrib.humanize',
|
||||
'django.contrib.staticfiles',
|
||||
'raven.contrib.django',
|
||||
'nexus',
|
||||
'gargoyle',
|
||||
'south',
|
||||
'piston',
|
||||
@@ -80,10 +79,6 @@ INSTALLED_APPS = (
|
||||
'tools',
|
||||
)
|
||||
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
'sso.backends.SimpleHashModelBackend',
|
||||
)
|
||||
|
||||
AUTH_PROFILE_MODULE = 'sso.SSOUser'
|
||||
LOGIN_REDIRECT_URL = "/profile"
|
||||
LOGIN_URL = "/login"
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
from django.contrib.auth.backends import ModelBackend
|
||||
from django.contrib.auth.models import User
|
||||
from hashlib import sha1
|
||||
|
||||
|
||||
class SimpleHashModelBackend(ModelBackend):
|
||||
|
||||
supports_anonymous_user = False
|
||||
supports_object_permissions = False
|
||||
supports_inactive_user = False
|
||||
|
||||
def authenticate(self, username=None, password=None):
|
||||
try:
|
||||
user = User.objects.get(username=username)
|
||||
except User.DoesNotExist:
|
||||
return None
|
||||
|
||||
if '$' in user.password:
|
||||
if user.check_password(password):
|
||||
return user
|
||||
else:
|
||||
if user.password == sha1(password).hexdigest():
|
||||
user.set_password(password)
|
||||
return user
|
||||
|
||||
return None
|
||||
@@ -62,7 +62,7 @@
|
||||
<li><a href="{% url sso.views.user_lookup %}">Lookup User</a></li>
|
||||
{% endif %}
|
||||
{% if request.user.is_staff %}
|
||||
<li><a href="/nexus/">Admin</a></li>
|
||||
<li><a href="/admin/">Admin</a></li>
|
||||
{% endif %}
|
||||
{% if "sentry"|installed %}
|
||||
{% if request.user.is_superuser %}
|
||||
|
||||
@@ -4,11 +4,11 @@ from django.contrib.auth.views import login
|
||||
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
from utils import installed
|
||||
from registration.views import register
|
||||
from sso.forms import RegistrationFormUniqueEmailBlocked
|
||||
|
||||
|
||||
admin.autodiscover()
|
||||
|
||||
urlpatterns = patterns('',
|
||||
@@ -45,7 +45,11 @@ if installed('nexus'):
|
||||
nexus.autodiscover()
|
||||
|
||||
urlpatterns += patterns('',
|
||||
(r'^nexus/', include(nexus.site.urls)),
|
||||
(r'^admin/', include('nexus.site.urls')),
|
||||
)
|
||||
else:
|
||||
urlpatterns += patterns('',
|
||||
url(r'^admin/', include('admin.site.urls')),
|
||||
)
|
||||
|
||||
if settings.DEBUG:
|
||||
|
||||
Reference in New Issue
Block a user