def edit_profile(): form = SignUpForm() if form.validate_on_submit(): data = dict(name=form.name.data, surname=form.surname.data, email=form.email.data, password=get_hash_password(form.password.data)) user = current_user user.update_db(**data) return redirect(url_for("user_app.dashboard")) return render_template("update.html", form=form, user=current_user)
def register(): form = SignUpForm() if form.validate_on_submit(): data = dict(name=form.name.data, surname=form.surname.data, email=form.email.data, password=form.password.data) # user = UserSchema().load(data) user = Users(**data) user.password = get_hash_password(user.password) user.save_db() login_user(user) return redirect(url_for("user_app.dashboard")) return render_template("register.html", form=form)
def hash_password(self, data, **kwargs): hashed_password = get_hash_password(data.get("password")) data.update({"password": hashed_password})
def hash_password(self, data, **kwargs): hashed_password = get_hash_password(data.get("password")) data.update({"password": hashed_password}) data.update({"email": data.get("email").lower()}) del data["password2"]