aboutsummaryrefslogtreecommitdiff
path: root/app/views/auth.py
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2021-06-03 23:45:17 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2021-06-03 23:45:17 +0530
commit42f0febd38f0427f33994b153c1a1d937afb609c (patch)
treed608275bf81c677cfb2b5d63be98eb092ff26f5b /app/views/auth.py
parent0090c644eb7eb088be5dc5a9889f654003c4d6c6 (diff)
fixed sign up form
Diffstat (limited to 'app/views/auth.py')
-rw-r--r--app/views/auth.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/views/auth.py b/app/views/auth.py
new file mode 100644
index 0000000..f31a4cd
--- /dev/null
+++ b/app/views/auth.py
@@ -0,0 +1,21 @@
+from app import app, db, models
+from app.forms.app_forms import UserSignUp
+from flask import render_template, flash
+from app.misc_func import flash_errors
+
+
+@app.route("/signup", methods=['GET', 'POST'])
+def register_user():
+ form = UserSignUp()
+ if form.validate_on_submit():
+ user = models.User(
+ first_name=form.first_name.data,
+ last_name=form.last_name.data,
+ email=form.email.data,
+ confirmation=False,
+ password=form.password.data,
+ )
+ db.session.add(user)
+ db.session.commit()
+ flash_errors(form)
+ return render_template("auth/signup.html",form=form) \ No newline at end of file