Created
August 17, 2015 22:14
-
-
Save art-solopov/f26b1943f3a8159c6f27 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
@app.before_request | |
def get_default_context(): | |
g.login_form = forms.LoginForm() | |
flashes = get_flashed_messages(with_categories=True) | |
g.messages = { 'notice': [ msg for cat, msg in flashes if cat == 'notice' ], | |
'error': [ msg for cat, msg in flashes if cat == 'error' ] } | |
#================================================================================ | |
class User(Base, Model, UserMixin): | |
__tablename__ = 'app_user' | |
# Columns here | |
# <...> | |
def check_password(self, password): | |
password = password.encode() | |
encoded_password = self.password.encode() | |
return hashpw(password, encoded_password) == encoded_password |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment