From a4a17f1e282e14adb4b6874d8d05ce8dbf5fafdb Mon Sep 17 00:00:00 2001
From: Krish M <krish94@uab.edu>
Date: Fri, 8 Apr 2022 12:42:03 -0500
Subject: [PATCH] added cerfity buttom feature

---
 app/__init__.py                         | 12 ++++++++----
 app/templates/errors/certification.html |  3 +--
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/app/__init__.py b/app/__init__.py
index 7a3e061..aa572f5 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -58,7 +58,7 @@ def create_app(config_name):
             return render_template('errors/blocked.html')
 
         elif rc_util.check_state(session['user'].get('username')) == "certification":
-            return render_template('errors/certification.html')
+            return redirect(url_for('certify_account')) 
         
         else:
             return render_template('auth/SignUp.html', room_id=session['uid'],
@@ -74,9 +74,13 @@ def create_app(config_name):
     def account_block():    
         return render_template('errors/blocked.html')
 
-    @app.route('/certify_account')
-    def error_certify():
-        return render_template('errors/certification.html')
+    @app.route("/certify_account", methods=['GET', 'POST'])
+    def certify_account():
+        if request.method == 'POST':
+            if request.form.get('action1') == 'VALUE1':
+                rc_util.update_state(session['user'].get('username'), ok)
+        elif request.method == 'GET':
+            return render_template('errors/certification.html', form=form)
 
     # misc page error catching
     @app.errorhandler(403)
diff --git a/app/templates/errors/certification.html b/app/templates/errors/certification.html
index 529b7c7..a290bf0 100644
--- a/app/templates/errors/certification.html
+++ b/app/templates/errors/certification.html
@@ -53,8 +53,7 @@
   <div class="col-md-10 col-sm-10 my-col">
     <div id="form-wrapper">
     <h2> Account/User Certification Needed </h2>
-    <p style="font-size:110%;"> {{ welcome_msg |safe }}</p>
-      <button class="btn btn-primary btn-md"  id="submit" name="submit" type="button" value="Submit" onclick="accountCertification()"> Certify Account</button>
+      <button class="btn btn-primary btn-md"  id="submit" name="submit" type="button" value="certify"> Certify Account</button>
     </div>
   </div>
 </div>  
-- 
GitLab