def change_password(): form = ChangePasswordForm() if form.validate_on_submit(): current_user.password = form.password.data db.session.commit() flash('Password updated.', 'success') return redirect(url_for('.index', username=current_user.username)) return render_template('user/settings/change_password.html', form=form)
def change_password(): form = ChangePasswordForm() if form.validate_on_submit() and current_user.validate_password( form.old_password.data): current_user.set_password(form.password.data) db.session.commit() flash("Password updated.", "success") return redirect(url_for("user.index", username=current_user.username)) return render_template("user/settings/change_password.html", form=form)
def change_password(): form = ChangePasswordForm() if form.validate_on_submit(): if current_user.validate_password(form.old_password.data): current_user.set_password(form.password.data) db.session.commit() flash('Password changed', 'success') return redirect(url_for('.index', username=current_user.username)) else: flash('Old passwrod is not corrent', 'warning') return render_template('user/settings/change_password.html', form=form)
def change_password(): form = ChangePasswordForm() if form.validate_on_submit(): if current_user.validate_password(form.old_password.data): current_user.set_password(form.new_password.data) # 重设密码 db.session.commit() flash('密码修改成功。', 'success') return redirect(url_for('.index', username=current_user.username)) else: flash('密码不正确!', 'warning') return render_template('user/settings/change_password.html', form=form)
def change_email_request(): form = ChangePasswordForm() if form.validate_on_submit(): token = generate_token(user=current_user, operation=Operations.CHANGE_EMAIL, new_email=form.email.data.lower()) send_change_email_email(to=form.email.data, user=current_user, token=token) flash('Confirm email sent, check your inbox.', 'info') return redirect(url_for('.index', username=current_user.username)) return render_template('user/settings/change_email.html', form=form)
def change_password(): """ 修改密码 """ logger.info('url = ' + str(request.url)) form = ChangePasswordForm() if form.validate_on_submit() and current_user.validate_password(form.old_password.data): current_user.set_password(form.password.data) db.session.commit() flash('密码修改成功!', 'success') return redirect(url_for('.index', username=current_user.username)) return render_template('user/settings/change_password.html', form=form)