diff options
author | Rodney Ewing <ewing.rj@gmail.com> | 2013-05-14 16:14:19 -0700 |
---|---|---|
committer | Rodney Ewing <ewing.rj@gmail.com> | 2013-05-24 16:52:48 -0700 |
commit | 744f1c83b9c94a82612c981ec56782f3db457357 (patch) | |
tree | 78502d15d31e62a4f42b73e208c6eeb49a439847 /mediagoblin/auth/views.py | |
parent | b56b6b1e77cc01aa1ebebd1c6c594ec79cb4d8c1 (diff) | |
download | mediagoblin-744f1c83b9c94a82612c981ec56782f3db457357.tar.lz mediagoblin-744f1c83b9c94a82612c981ec56782f3db457357.tar.xz mediagoblin-744f1c83b9c94a82612c981ec56782f3db457357.zip |
add a check for authentication plugin on startup and respond according to no_auth config option. allows instance to be run w/o authentication
Diffstat (limited to 'mediagoblin/auth/views.py')
-rw-r--r-- | mediagoblin/auth/views.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index ec409303..811bb157 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -44,8 +44,9 @@ def register(request): Note that usernames will always be lowercased. Email domains are lowercased while the first part remains case-sensitive. """ - # Redirects to indexpage if registrations are disabled - if not mg_globals.app_config["allow_registration"]: + # Redirects to indexpage if registrations are disabled or no authentication + # is enabled + if not mg_globals.app_config["allow_registration"] or not mg_globals.app.auth: messages.add_message( request, messages.WARNING, @@ -88,6 +89,14 @@ def login(request): If you provide the POST with 'next', it'll redirect to that view. """ + # Redirects to index page if no authentication is enabled + if not mg_globals.app.auth: + messages.add_message( + request, + messages.WARNING, + _('Sorry, authentication is disabled on this instance.')) + return redirect(request, 'index') + login_form = auth.get_login_form(request) login_failed = False |