Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Signup route example, hashing with "sha256" method to fix the user signup and login system at PythonAnyWhere
- @app.route("/signup", methods=["GET", "POST"])
- def signup():
- form = RegisterForm()
- if form.validate_on_submit():
- hashed_pw = generate_password_hash(form.password.data, method="sha256")
- new_user = Users(username=form.username.data, email=form.email.data, password=hashed_pw)
- db.session.add(new_user)
- db.session.commit()
- flash("You've been registered successfully", "alert-success")
- return redirect(url_for("signin"))
- return render_template("signup.html", form=form)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement