diff options
author | Georg | 2021-09-02 01:47:37 +0200 |
---|---|---|
committer | Georg | 2021-09-02 01:47:37 +0200 |
commit | d5f5ac7bd254ac591b4bbeb606565ac22e2ce35c (patch) | |
tree | 3796dcd10f25f5cd35cb138279c888680925f0ba /flaskapp.py | |
parent | 840265c745e668addfcd4afa741f7835cd98dca9 (diff) | |
download | webreg-d5f5ac7bd254ac591b4bbeb606565ac22e2ce35c.tar.gz webreg-d5f5ac7bd254ac591b4bbeb606565ac22e2ce35c.tar.bz2 webreg-d5f5ac7bd254ac591b4bbeb606565ac22e2ce35c.zip |
Savepointdevel_multireg
Signed-off-by: Georg <georg@lysergic.dev>
Diffstat (limited to 'flaskapp.py')
-rw-r--r-- | flaskapp.py | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/flaskapp.py b/flaskapp.py index c8ce2d3..440b407 100644 --- a/flaskapp.py +++ b/flaskapp.py @@ -1,5 +1,5 @@ from flask import Flask, render_template, url_for, request, redirect, flash -from forms import RegistrationForm +from forms import RegistrationForm, OptionForm from irc_register import ircregister #from irc_verify import ircverify @@ -23,13 +23,30 @@ def kiwinick(): @app.route('/register', methods=['GET', 'POST']) def register(): - form = RegistrationForm() - if request.method == 'POST': + optionform = OptionForm() + registerform = RegistrationForm() + if optionform.validate_on_submit(): + option = request.form['options'] + print(option) + print(form.option.data) + if option == 'mail-old': + return "<script>window.location.replace('/register1')</script>", 200 + #return "<script>window.location.href = '/register1'</script>", 200 + elif option == 'mail-new': + return "<script>window.location.replace('/register2')</script>", 200 + + return render_template('register.html', title='Register', optionform=optionform, registerform=registerform) +@app.route('/register1', methods=['GET', 'POST']) +def register1(): + optionform = OptionForm() + registerform = RegistrationForm() + if request.method == 'POST': username = request.form.get('username') email = request.form.get('email') password = request.form.get('password') -# email = request.form.get('email') add password arg to ircregisterfunction + option = request.form['options'] + print(option) response = ircregister(username, password, email) if response == "433": flash("IRC username already taken. Please select a different username") @@ -42,7 +59,8 @@ def register(): elif response == "ssoerr": flash("Sorry, we messed up. Please contact an administrator.") - return render_template('register.html', title='Register', form=form) + return render_template('register1.html', title='Register', optionform=optionform, registerform=registerform) + #@app.route('/verify', methods=['GET', 'POST']) #def verify(): |