Add initial support for mobile login / user menu etc.
This commit is contained in:
parent
9d9bc58a99
commit
b5c81244ac
4
rattail_demo/web/templates/mobile/base.mako
Normal file
4
rattail_demo/web/templates/mobile/base.mako
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
## -*- coding: utf-8 -*-
|
||||||
|
<%inherit file="tailbone:templates/mobile/base_external_toolbars.mako" />
|
||||||
|
|
||||||
|
${parent.body()}
|
6
rattail_demo/web/templates/mobile/login.mako
Normal file
6
rattail_demo/web/templates/mobile/login.mako
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
## -*- coding: utf-8 -*-
|
||||||
|
<%inherit file="tailbone:templates/mobile/login.mako" />
|
||||||
|
|
||||||
|
<p>Login with <strong>chuck / admin</strong> for full demo access.</p>
|
||||||
|
|
||||||
|
${parent.body()}
|
|
@ -5,32 +5,20 @@ Auth views
|
||||||
|
|
||||||
from __future__ import unicode_literals, absolute_import
|
from __future__ import unicode_literals, absolute_import
|
||||||
|
|
||||||
from pyramid import httpexceptions
|
|
||||||
|
|
||||||
from tailbone.views import auth as base
|
from tailbone.views import auth as base
|
||||||
|
|
||||||
|
|
||||||
def change_password(request):
|
class AuthenticationView(base.AuthenticationView):
|
||||||
# prevent password change for 'chuck'
|
"""
|
||||||
if request.user and request.user.username == 'chuck':
|
Prevent password change for 'chuck' user
|
||||||
request.session.flash("Cannot change password for 'chuck' in Rattail Demo")
|
"""
|
||||||
return httpexceptions.HTTPFound(location=request.get_referrer())
|
|
||||||
return base.change_password(request)
|
def change_password(self):
|
||||||
|
if self.request.user and self.request.user.username == 'chuck':
|
||||||
|
self.request.session.flash("Cannot change password for 'chuck' in Rattail Demo")
|
||||||
|
return self.redirect(self.request.get_referrer())
|
||||||
|
return super(AuthenticationView, self).change_password()
|
||||||
|
|
||||||
|
|
||||||
def includeme(config):
|
def includeme(config):
|
||||||
# TODO: this is way too much duplication, surely..
|
AuthenticationView.defaults(config)
|
||||||
base.add_routes(config)
|
|
||||||
|
|
||||||
config.add_forbidden_view(base.forbidden)
|
|
||||||
|
|
||||||
config.add_view(base.login, route_name='login',
|
|
||||||
renderer='/login.mako')
|
|
||||||
|
|
||||||
config.add_view(base.logout, route_name='logout')
|
|
||||||
|
|
||||||
config.add_view(base.become_root, route_name='become_root')
|
|
||||||
config.add_view(base.stop_root, route_name='stop_root')
|
|
||||||
|
|
||||||
config.add_view(change_password, route_name='change_password',
|
|
||||||
renderer='/change_password.mako')
|
|
||||||
|
|
Loading…
Reference in a new issue