def user(username): user = User.query.filter_by(username=username).first_or_404() if current_user.id != user.id: return render_template("index.html", msg=msg_other_user) form = ChangePasswordForm() amount = Item.amount_of_items_by_userid(current_user.id) return render_template("auth/userprofile.html", user=user, amount=amount, form=form, username=username)
def changePassword(): username = current_user.username form = ChangePasswordForm(request.form) if not form.validate(): amount = Item.amount_of_items_by_userid(current_user.id) return render_template("auth/userprofile.html", user=user, amount=amount, form=form, username=username) u = User.query.get(current_user.id) u.password = form.password.data db.session().commit() return redirect(url_for("items_index"))