def password(): form = PasswordForm() if form.validate_on_submit(): form.populate_obj(user) user.password = form.new_password.data db.session.commit() flash('Password updated.', 'success') return render_template('user/password.html', form=form)