Example #1
0
def change_password():
    uid = current_user.get_id()
    pw_old = request.form['oldpwd']
    if not current_user.authenticate(pw_old):
        flask.flash("Ooops, old password is wrong!", "error")
        return flask.redirect(url_for(".info"))

    pw1 = request.form['password1']
    pw2 = request.form['password2']
    if pw1 != pw2:
        flask.flash("Oops, new passwords do not match!", "error")
        return flask.redirect(url_for(".info"))

    pwdmanager.change_password(uid, pw1)
    flask.flash("Your password has been changed.")
    return flask.redirect(url_for(".info"))
Example #2
0
def change_password():
    uid = current_user.get_id()
    pw_old = request.form['oldpwd']
    if not current_user.authenticate(pw_old):
        flask.flash("Ooops, old password is wrong!", "error")
        return flask.redirect(url_for(".info"))

    pw1 = request.form['password1']
    pw2 = request.form['password2']
    if pw1 != pw2:
        flask.flash("Oops, new passwords do not match!", "error")
        return flask.redirect(url_for(".info"))

    pwdmanager.change_password(uid, pw1)
    flask.flash("Your password has been changed.")
    return flask.redirect(url_for(".info"))