mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 23:02:19 +00:00
Removed Nexus, switched to default backends
This commit is contained in:
@@ -63,7 +63,6 @@ INSTALLED_APPS = (
|
|||||||
'django.contrib.humanize',
|
'django.contrib.humanize',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'raven.contrib.django',
|
'raven.contrib.django',
|
||||||
'nexus',
|
|
||||||
'gargoyle',
|
'gargoyle',
|
||||||
'south',
|
'south',
|
||||||
'piston',
|
'piston',
|
||||||
@@ -80,10 +79,6 @@ INSTALLED_APPS = (
|
|||||||
'tools',
|
'tools',
|
||||||
)
|
)
|
||||||
|
|
||||||
AUTHENTICATION_BACKENDS = (
|
|
||||||
'sso.backends.SimpleHashModelBackend',
|
|
||||||
)
|
|
||||||
|
|
||||||
AUTH_PROFILE_MODULE = 'sso.SSOUser'
|
AUTH_PROFILE_MODULE = 'sso.SSOUser'
|
||||||
LOGIN_REDIRECT_URL = "/profile"
|
LOGIN_REDIRECT_URL = "/profile"
|
||||||
LOGIN_URL = "/login"
|
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>
|
<li><a href="{% url sso.views.user_lookup %}">Lookup User</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if request.user.is_staff %}
|
{% if request.user.is_staff %}
|
||||||
<li><a href="/nexus/">Admin</a></li>
|
<li><a href="/admin/">Admin</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if "sentry"|installed %}
|
{% if "sentry"|installed %}
|
||||||
{% if request.user.is_superuser %}
|
{% 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.contrib.staticfiles.urls import staticfiles_urlpatterns
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
from utils import installed
|
from utils import installed
|
||||||
from registration.views import register
|
from registration.views import register
|
||||||
from sso.forms import RegistrationFormUniqueEmailBlocked
|
from sso.forms import RegistrationFormUniqueEmailBlocked
|
||||||
|
|
||||||
|
|
||||||
admin.autodiscover()
|
admin.autodiscover()
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
@@ -45,7 +45,11 @@ if installed('nexus'):
|
|||||||
nexus.autodiscover()
|
nexus.autodiscover()
|
||||||
|
|
||||||
urlpatterns += patterns('',
|
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:
|
if settings.DEBUG:
|
||||||
|
|||||||
Reference in New Issue
Block a user