def account(): form = UpdateForm() if form.validate_on_submit(): current_user.username = form.username.data current_user.password = bcrypt.generate_password_hash(form.password.data).decode('utf-8') db.session.commit() return redirect(url_for('users.account')) elif request.method == 'GET': form.username.data = current_user.username form.password.data = current_user.password return render_template('account.html', title='Account', form=form, current_user=current_user)
def account(): form = UpdateForm() if form.validate_on_submit(): current_user.username = form.username.data db.session.commit() return redirect(url_for('users.account')) elif request.method == 'GET': form.username.data = current_user.username return render_template('account.html', title='Account', form=form)
def account(): form = UpdateForm() return 'Account'