rattail-demo/rattail_demo/web/views/auth.py

25 lines
645 B
Python

# -*- coding: utf-8 -*-
"""
Auth views
"""
from __future__ import unicode_literals, absolute_import
from tailbone.views import auth as base
class AuthenticationView(base.AuthenticationView):
"""
Prevent password change for 'chuck' user
"""
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):
AuthenticationView.defaults(config)