summaryrefslogtreecommitdiffstats
path: root/flaskapp.py
diff options
context:
space:
mode:
authorGeorg2021-09-01 16:36:05 +0200
committerGeorg2021-09-01 16:36:05 +0200
commit840265c745e668addfcd4afa741f7835cd98dca9 (patch)
treeec9dc00d0a92c871912564e32299247e312d01cf /flaskapp.py
parentd2e8fcd2b5949c7836feaf559cd65c5062a7748c (diff)
downloadwebreg-840265c745e668addfcd4afa741f7835cd98dca9.tar.gz
webreg-840265c745e668addfcd4afa741f7835cd98dca9.tar.bz2
webreg-840265c745e668addfcd4afa741f7835cd98dca9.zip
Improved error handling and Kiwi redirect
Signed-off-by: Georg <georg@lysergic.dev>
Diffstat (limited to 'flaskapp.py')
-rw-r--r--flaskapp.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/flaskapp.py b/flaskapp.py
index cfa21e8..c8ce2d3 100644
--- a/flaskapp.py
+++ b/flaskapp.py
@@ -11,14 +11,15 @@ app.config['SECRET_KEY'] = '$secret' #remove later
def hello():
return render_template('home.html')
+#@app.route('/kiwi')
+#def kiwi():
+# return redirect("https://liberta.casa/kiwi/")
@app.route('/kiwi')
-def kiwi():
- return redirect("https://liberta.casa/kiwi/")
-@app.route('/kiwi/')
-def kiwinick(nick, show_password_box):
+def kiwinick():
nick = request.args.get('nick', None)
- show_password_box = requests.args.get('show_password_box', None)
- return redirect("https://liberta.casa/kiwi/")
+ show_password_box = request.args.get('show_password_box', None)
+ redirect_url = 'https://liberta.casa/kiwi/'+'?nick='+nick+'&show_password_box'+'='+show_password_box
+ return redirect(redirect_url)
@app.route('/register', methods=['GET', 'POST'])
def register():
@@ -30,14 +31,16 @@ def register():
password = request.form.get('password')
# email = request.form.get('email') add password arg to ircregisterfunction
response = ircregister(username, password, email)
- if response == "server failure":
- flash("Server Unavailable")
- elif response == "433":
- flash("Username already taken. Please select a different username")
+ if response == "433":
+ flash("IRC username already taken. Please select a different username")
+ elif response == "409":
+ flash("User already exists.")
elif response == "success":
return redirect(url_for('kiwinick', nick=username, show_password_box='true'))
- elif response == "failure":
- flash("Failure! Please try after some time or use NickServ.")
+ elif response == "invalidemail":
+ flash("Is that a valid email address?")
+ elif response == "ssoerr":
+ flash("Sorry, we messed up. Please contact an administrator.")
return render_template('register.html', title='Register', form=form)