def register(): if current_user.firm == "Collibri": form = RegistrationForm() if form.validate_on_submit(): hashed_pw = bcrypt.generate_password_hash( form.password.data).decode("utf-8") user = User( username=form.username.data, email=form.email.data, password=hashed_pw, firm=form.firm.data, function=form.function.data, ) db.session.add(user) db.session.commit() flash("The account has been created! You are now able to log in.", "succes") return redirect(url_for("arcticsun_index", device_type="arctic")) return render_template("authentication/register.html", title="Register", form=form)