Flask-User API

Template variables

The following template variables are available for use in email and form templates:

user_manager       # points to the UserManager object

Template functions

The following template functions are available for use in email and form templates:

# Function                           Setting                   # Default
url_for('user.change_password')      USER_CHANGE_PASSWORD_URL      = '/user/change-password'
url_for('user.change_username')      USER_CHANGE_USERNAME_URL      = '/user/change-username'
url_for('user.confirm_email')        USER_CONFIRM_EMAIL_URL        = '/user/confirm-email/<token>'
url_for('user.email_action')         USER_EMAIL_ACTION_URL         = '/user/email/<id>/<action>'    # v0.5.1 and up
url_for('user.forgot_password')      USER_FORGOT_PASSWORD_URL      = '/user/forgot-password'
url_for('user.login')                USER_LOGIN_URL                = '/user/sign-in'
url_for('user.logout')               USER_LOGOUT_URL               = '/user/sign-out'
url_for('user.register')             USER_REGISTER_URL             = '/user/register'
url_for('user.resend_email_confirmation') USER_RESEND_EMAIL_CONFIRMATION_URL = '/user/resend-email-confirmation'   # v0.5.0 and up
url_for('user.reset_password')       USER_RESET_PASSWORD_URL       = '/user/reset-password/<token>'
url_for('user.profile')              USER_PROFILE_URL              = '/user/profile'                # v0.5.5 and up

hash_password()

user_manager.hash_password(password)
# Returns hashed 'password' using the configured password hash
# Config settings: USER_PASSWORD_HASH_MODE = 'passlib'
#                  USER_PASSWORD_HASH      = 'bcrypt'
#                  USER_PASSWORD_SALT      = SECRET_KEY

verify_password()

user_manager.verify_password(password, user.password)
# Returns True if 'password' matches the user's 'hashed password'
# Returns False otherwise.

Signals

# Signal                    # Sent when ...
user_changed_password       # a user changed their password
user_changed_username       # a user changed their username
user_confirmed_email        # a user confirmed their email
user_forgot_password        # a user submitted a reset password request
user_logged_in              # a user logged in
user_logged_out             # a user logged out
user_registered             # a user registered for a new account
user_reset_password         # a user reset their password (forgot password)