Skip to content

Commit

Permalink
disable user login until issues on production server are resolved.
Browse files Browse the repository at this point in the history
  • Loading branch information
visiblegovernment committed Oct 25, 2011
1 parent af4242a commit 6240cf9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
LOGIN_ERROR_URL = '/accounts/login/error/'
SOCIAL_AUTH_ERROR_KEY = 'socialauth_error'
LOGIN_REDIRECT_URL = '/accounts/home/'
LOGIN_DISABLED = True

#################################################################################
# These variables Should be defined in the local settings file
Expand Down
7 changes: 7 additions & 0 deletions templates/registration/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
{% load i18n %}
{% block title %}{% trans "Sign In" %}{% endblock %}
{% block content %}
{% if login_disabled %}
<div id='account-form'>
<h3>{% trans "Sign In" %}</h3>
<p>Sorry, user sign-in is temporarily disabled.</p>
</div>
{% else %}
<div id='account-form'>
<h3>{% trans "Sign In" %}</h3>
<form action="/accounts/login/" method="POST">{% csrf_token %}
Expand Down Expand Up @@ -37,5 +43,6 @@ <h3>{% trans "Sign In" %}</h3>
</ul>
</div>
</div>
{% endif %}
{% endblock %}

14 changes: 9 additions & 5 deletions urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@
(r'^password_reset/done/$', 'django.contrib.auth.views.password_reset_done'),
(r'^reset/(?P<uidb36>[-\w]+)/(?P<token>[-\w]+)/$', 'django.contrib.auth.views.password_reset_confirm'),
(r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete'),
(r'^admin/', admin.site.urls,{'SSL':SSL_ON}),
(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^login/(?P<backend>[^/]+)/$', social_auth, name='begin'),
url(r'^disconnect/(?P<backend>[^/]+)/$', social_disconnect, name='socialdisconnect'),
)

if not settings.LOGIN_DISABLED:
urlpatterns += patterns('',
(r'^admin/', admin.site.urls,{'SSL':SSL_ON}),
(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^login/(?P<backend>[^/]+)/$', social_auth, name='begin'),
url(r'^disconnect/(?P<backend>[^/]+)/$', social_disconnect, name='socialdisconnect'),
)

urlpatterns += patterns('',
(r'^feeds/cities/(\d+)$', CityIdFeed()), # backwards compatibility
(r'^feeds/wards/(\d+)$', WardIdFeed()), # backwards compatibility
Expand Down Expand Up @@ -107,7 +111,7 @@
'template_name':'registration/login.html',
'authentication_form':FMSAuthenticationForm,
'extra_context':
{ 'providers': SUPPORTED_SOCIAL_PROVIDERS }}, name='auth_login'),
{ 'providers': SUPPORTED_SOCIAL_PROVIDERS, 'login_disabled': settings.LOGIN_DISABLED }}, name='auth_login'),
url(r'^accounts/logout/$', auth_views.logout,
{'SSL':SSL_ON,
'next_page': '/'}, name='auth_logout' ),
Expand Down

0 comments on commit 6240cf9

Please sign in to comment.