Created
June 4, 2015 17:38
-
-
Save gcarothers/e2bfb2ec36023add0365 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def forbid_user_messages(request, user): | |
"""Provide messaging to users who have an active session and become | |
disabled for some reason.""" | |
if user.inactive and not request.is_xhr: | |
# Log out inactive users. | |
headers = forget(request) | |
if user.trial_expiration: | |
error_msg = """Your Lex Machina trial has expired. | |
Please <a href="mailto:sales@lexmachina.com">contact sales</a> | |
to subscribe.""" | |
else: | |
error_msg = """Your Lex Machina account has been disabled. | |
If you have any questions, please | |
<a href="mailto:support@lexmachina.com">contact our customer | |
support</a>.""" | |
request.session.flash(error_msg, 'error', allow_duplicate=False) | |
raise HTTPForbidden(headers=headers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment