summaryrefslogtreecommitdiffstats
path: root/flaskapp.py
diff options
context:
space:
mode:
Diffstat (limited to 'flaskapp.py')
-rw-r--r--flaskapp.py28
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():