Skip to content

Instantly share code, notes, and snippets.

@art-solopov
Created August 17, 2015 22:14
Show Gist options
  • Save art-solopov/f26b1943f3a8159c6f27 to your computer and use it in GitHub Desktop.
Save art-solopov/f26b1943f3a8159c6f27 to your computer and use it in GitHub Desktop.
@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