예제 #1
0
def reset_password(reset_key):
  """Checks the reset key. If successful, displays the password reset prompt."""
  username = auth_utils.check_reset_key(reset_key)
  if username is None:
    flask.flash('Invalid request. If your link has expired, then you will need to generate a new one. If you continue to encounter problems, please find an IMSS rep.')
    return flask.redirect(flask.url_for('auth.forgot_password'))
  return flask.render_template('reset_password.html', username=username,
      reset_key=reset_key)
예제 #2
0
def reset_password(reset_key):
    """Checks the reset key. If successful, displays the password reset prompt."""
    username = auth_utils.check_reset_key(reset_key)
    if username is None:
        flask.flash(
            'Invalid request. If your link has expired, then you will need to generate a new one. If you continue to encounter problems, please find an IMSS rep.'
        )
        return flask.redirect(flask.url_for('auth.forgot_password'))
    return flask.render_template('reset_password.html',
                                 username=username,
                                 reset_key=reset_key)
예제 #3
0
def reset_password_submit(reset_key):
  """Handles a password reset request."""
  username = auth_utils.check_reset_key(reset_key)
  if username is None:
    # Reset key was invalid.
    flask.flash("Someone's making it on the naughty list this year...")
    return flask.redirect(flask.url_for('auth.forgot_password'))
  new_password = flask.request.form.get('password', '')
  new_password2 = flask.request.form.get('password2', '')
  if helpers.handle_password_reset(username, new_password, new_password2):
    flask.flash('Password reset was successful.')
    return flask.redirect(flask.url_for('auth.login'))
  else:
    # Password reset handler handles error flashes.
    return flask.redirect(flask.url_for('auth.reset_password', reset_key=reset_key))
예제 #4
0
def reset_password_submit(reset_key):
    """Handles a password reset request."""
    username = auth_utils.check_reset_key(reset_key)
    if username is None:
        # Reset key was invalid.
        flask.flash("Someone's making it on the naughty list this year...")
        return flask.redirect(flask.url_for('auth.forgot_password'))
    new_password = flask.request.form.get('password', '')
    new_password2 = flask.request.form.get('password2', '')
    if helpers.handle_password_reset(username, new_password, new_password2):
        flask.flash('Password reset was successful.')
        return flask.redirect(flask.url_for('auth.login'))
    else:
        # Password reset handler handles error flashes.
        return flask.redirect(
            flask.url_for('auth.reset_password', reset_key=reset_key))