From b3e88006adca82c5cd7137d8ef59402672c55fc0 Mon Sep 17 00:00:00 2001
From: Krish M <krish94@uab.edu>
Date: Tue, 17 May 2022 21:05:00 -0500
Subject: [PATCH 1/6] Feat Annual recertification workflow

1. Created and send pre_certification and certification message to certify.html
2. Added 2 checkboxes for user policies and toggle button logic to certify account
3. Rewrote dom from step 1 (pre_certification) to step 2 (certification page)
---
 app/__init__.py                    |  2 +-
 app/static/scripts/function.js     | 16 ++++++++++++++--
 app/templates/account/certify.html | 20 +++++++++++++++-----
 messages.py                        |  3 ++-
 4 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/app/__init__.py b/app/__init__.py
index 871f080..e37cb6e 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -58,7 +58,7 @@ def create_app(config_name):
                                username=session['user'].get('username'),
                                fullname=session['user'].get('fullname'), email=session['user'].get('email'),
                                referrer=session['return_url'], cancel_url=vars.default_referrer,
-                               cancel_msg=messages.cancel_message, certification_message=messages.certification_message)
+                               cancel_msg=messages.cancel_message, pre_certification_msg=messages.pre_certification_message, certification_msg=messages.certification_message)
         else:
             return render_template('auth/SignUp.html', room_id=session['uid'],
                                username=session['user'].get('username'),
diff --git a/app/static/scripts/function.js b/app/static/scripts/function.js
index 3527e3c..73c3017 100644
--- a/app/static/scripts/function.js
+++ b/app/static/scripts/function.js
@@ -1,7 +1,19 @@
+function preCertification() {
+  const element = document.getElementById("pre-certify");
+  element.remove();
+  var x = document.getElementById("user-recertify");
+  if (x.style.display === "block") {
+    x.style.display = "none";
+  } else {
+    x.style.display = "block";
+  }
+}
+
 function check() { 
   var submitButton = document.getElementById("submit");
-  let ckbox = document.getElementById('agree');
-  submitButton.disabled = !ckbox.checked;
+  let ckbox1 = document.getElementById('agree1');
+  let ckbox2 = document.getElementById('agree2');
+  submitButton.disabled = !(ckbox1.checked && ckbox2.checked);
 };
 
 function displayloading1() {
diff --git a/app/templates/account/certify.html b/app/templates/account/certify.html
index 1ed9819..f23e43b 100644
--- a/app/templates/account/certify.html
+++ b/app/templates/account/certify.html
@@ -79,9 +79,16 @@
 
   <div class="col-md-10 col-sm-10 my-col">
     <div id="form-wrapper">
-    <h2> Annual Recertification Form </h2>
-    <p style="font-size:110%;"> {{ certification_message |safe }}</p>
-      <div id="user-input">    
+    <h2> Annual Recertification</h2>
+    <div id="pre-certify">
+      <p style="font-size:110%;"> {{ pre_certification_msg |safe }}</p>
+      <div class="col-md-7 col-sm-7 my-col">
+        <button class="btn btn-danger btn-md" id="cancel" name="cancel" type="button" onClick="renderDom('Account  Certification Cancelled','{{ cancel_msg |safe }}', null)">Cancel</button>
+        <button class="btn btn-primary btn-md"  id="submit" name="submit" type="button" value="Submit" onclick="preCertification()"> Continue to Certification</button>
+      </div>
+    </div>
+    <div id="user-recertify" style="display: none">
+    <p style="font-size:110%;"> {{ certification_msg |safe }}</p>
         <form id="signup" data-toggle="validator" role="form" action="." method="post" onsubmit="">
           <div class="col-md-7 col-sm-7 my-col">
             <label for="username" class="control-label">Blazer Id:</label>&#9;<input id="username" class="form-control" placeholder="Enter Username" required><br>
@@ -93,12 +100,15 @@
             <label for="email" class="control-label">Email:</label>&#9;<input id="email" class="form-control" placeholder="Enter Email" required><br>
           </div>
           <br>
-          <div class="col-md-7 col-sm-7 my-col">
+          <div class="col-md-10 col-sm-10 my-col">
+            <br><input class="checks" id ="agree1" type="checkbox" name="agree" value="agree" onchange= check() /> I have read & accept UAB IT's <a href="https://secure2.compliancebridge.com/uab/public/index.php?fuseaction=print.preview&docID=786">Acceptable Use Policy</a> and <a href="https://www.uab.edu/it/home/policies/data-classification/classification-overview">Data Classification Policy</a><br/>
+            <br><input class="checks" id ="agree2" type="checkbox" name="agree" value="agree" onchange= check() /> I also understand that it is my responsibility to follow all relevant <a href="https://www.uab.edu/it/home/policies">IT policies</a> when using this resource.<br/>            
             <button class="btn btn-danger btn-md" id="cancel" name="cancel" type="button" onClick="renderDom('Account  Certification Cancelled','{{ cancel_msg |safe }}', null)">Cancel</button> 
-            <button class="btn btn-primary btn-md"  id="submit" name="submit" type="button" value="Submit" onclick="displayloading1();certify_account()"> Certify Account</button>
+            <button class="btn btn-primary btn-md" disabled  id="submit" name="submit" type="button" value="Submit" onclick="displayloading1();certify_account()"> Certify Account</button>
           </div>
         </form>
       </div>
+      </div>
     </div>
   </div>
 </div>  
diff --git a/messages.py b/messages.py
index 8463099..52788e5 100644
--- a/messages.py
+++ b/messages.py
@@ -1,5 +1,6 @@
 welcome_message = "The information below will be used to create your account. Please fill in the reason for requesting your account as this helps us understand our user base.<br>Contact <a href='mailto:support@listserv.uab.edu'>Research Computing</a> if you have any questions."
 cancel_message = "Close current tab to end session.<br>Contact <a href="'mailto:support@listserv.uab.edu'">Research Computing</a> if you have any questions."
 error_message = "An error occurred while creating your account. Research Computing team has been notified and is working on fixing it.<br>Contact <a href='mailto:support@listserv.uab.edu'>Research Computing</a> if you have any questions."
-certification_message = "Welcome back to the UAB Research Computing services page.<br>We are asking for researchers to recertify their accounts annually so that we'll know who is still actively using the systems. <br>Fill out the form below and hit the Certify Account button when you are done."
 unauthorized_message = "Your UAB Research Computing account is currently on hold.<br>Accounts are put on hold if there are changes with UAB affiliation or if there is an issue on one of the platforms.<br>Please reach out to <a href="'mailto:support@listserv.uab.edu'">Research Computing</a> or attend the weekly office hours and we'll work with you to clear your account."
+pre_certification_message = "Welcome back to the UAB Research Computing services page.<br>We are asking for researchers to recertify their accounts annually so that we'll know who is still actively using the systems. <br> To continue with the self certification process click on continue below"
+certification_message = "Welcome back to the UAB Research Computing services page.<br>The usage of this resource is governed by UAB IT's <a href=' https://secure2.compliancebridge.com/uab/public/index.php?fuseaction=print.preview&docID=786' target='_blank'>Acceptable Use Policy </a> and <a href='https://www.uab.edu/it/home/policies/data-classification/classification-overview' target='_blank'>Data Classification Policy</a><br>To read and understand all UAB IT policies click <a href=' https://www.uab.edu/it/home/policies' target='_blank'>here</a><br>Fill out the form below and hit the Certify Account button when you are done."
-- 
GitLab


From 27aa5595167b63c8342698e5146af7b56524ec87 Mon Sep 17 00:00:00 2001
From: Krish M <krish94@uab.edu>
Date: Tue, 17 May 2022 21:35:10 -0500
Subject: [PATCH 2/6] modified certification message

---
 messages.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/messages.py b/messages.py
index 52788e5..6800391 100644
--- a/messages.py
+++ b/messages.py
@@ -3,4 +3,4 @@ cancel_message = "Close current tab to end session.<br>Contact <a href="'mailto:
 error_message = "An error occurred while creating your account. Research Computing team has been notified and is working on fixing it.<br>Contact <a href='mailto:support@listserv.uab.edu'>Research Computing</a> if you have any questions."
 unauthorized_message = "Your UAB Research Computing account is currently on hold.<br>Accounts are put on hold if there are changes with UAB affiliation or if there is an issue on one of the platforms.<br>Please reach out to <a href="'mailto:support@listserv.uab.edu'">Research Computing</a> or attend the weekly office hours and we'll work with you to clear your account."
 pre_certification_message = "Welcome back to the UAB Research Computing services page.<br>We are asking for researchers to recertify their accounts annually so that we'll know who is still actively using the systems. <br> To continue with the self certification process click on continue below"
-certification_message = "Welcome back to the UAB Research Computing services page.<br>The usage of this resource is governed by UAB IT's <a href=' https://secure2.compliancebridge.com/uab/public/index.php?fuseaction=print.preview&docID=786' target='_blank'>Acceptable Use Policy </a> and <a href='https://www.uab.edu/it/home/policies/data-classification/classification-overview' target='_blank'>Data Classification Policy</a><br>To read and understand all UAB IT policies click <a href=' https://www.uab.edu/it/home/policies' target='_blank'>here</a><br>Fill out the form below and hit the Certify Account button when you are done."
+certification_message = "Welcome back to the UAB Research Computing services page.<br>The usage of this resource is governed by UAB IT's <a href=' https://secure2.compliancebridge.com/uab/public/index.php?fuseaction=print.preview&docID=786' target='_blank'>Acceptable Use Policy </a> and <a href='https://www.uab.edu/it/home/policies/data-classification/classification-overview' target='_blank'>Data Classification Policy</a><br>To read and understand all UAB IT policies click <a href=' https://www.uab.edu/it/home/policies' target='_blank'>here</a><br>Verify your information in the form below and hit the Certify Account button when you are done."
-- 
GitLab


From 0bd3639619e18c81837bd9a60823b450613cf5d8 Mon Sep 17 00:00:00 2001
From: Krish M <krish94@uab.edu>
Date: Tue, 17 May 2022 21:36:01 -0500
Subject: [PATCH 3/6] added target='_blank' to hrefs to open in new tab

---
 app/templates/account/certify.html | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/app/templates/account/certify.html b/app/templates/account/certify.html
index f23e43b..180ce52 100644
--- a/app/templates/account/certify.html
+++ b/app/templates/account/certify.html
@@ -99,10 +99,9 @@
           <div class="col-md-7 col-sm-7 my-col">
             <label for="email" class="control-label">Email:</label>&#9;<input id="email" class="form-control" placeholder="Enter Email" required><br>
           </div>
-          <br>
           <div class="col-md-10 col-sm-10 my-col">
-            <br><input class="checks" id ="agree1" type="checkbox" name="agree" value="agree" onchange= check() /> I have read & accept UAB IT's <a href="https://secure2.compliancebridge.com/uab/public/index.php?fuseaction=print.preview&docID=786">Acceptable Use Policy</a> and <a href="https://www.uab.edu/it/home/policies/data-classification/classification-overview">Data Classification Policy</a><br/>
-            <br><input class="checks" id ="agree2" type="checkbox" name="agree" value="agree" onchange= check() /> I also understand that it is my responsibility to follow all relevant <a href="https://www.uab.edu/it/home/policies">IT policies</a> when using this resource.<br/>            
+            <br><input class="checks" id ="agree1" type="checkbox" name="agree" value="agree" onchange= check() /> I have read & accept UAB IT's <a href="https://secure2.compliancebridge.com/uab/public/index.php?fuseaction=print.preview&docID=786" target="_blank">Acceptable Use Policy</a> and <a href="https://www.uab.edu/it/home/policies/data-classification/classification-overview" target="_blank">Data Classification Policy</a><br/>
+            <br><input class="checks" id ="agree2" type="checkbox" name="agree" value="agree" onchange= check() /> I also understand that it is my responsibility to follow all relevant <a href="https://www.uab.edu/it/home/policies" target="_blank">IT policies</a> when using this resource.<br/>            
             <button class="btn btn-danger btn-md" id="cancel" name="cancel" type="button" onClick="renderDom('Account  Certification Cancelled','{{ cancel_msg |safe }}', null)">Cancel</button> 
             <button class="btn btn-primary btn-md" disabled  id="submit" name="submit" type="button" value="Submit" onclick="displayloading1();certify_account()"> Certify Account</button>
           </div>
-- 
GitLab


From f2fad2fec33346b32cbbef34ea28384a158049cd Mon Sep 17 00:00:00 2001
From: Krish M <krish94@uab.edu>
Date: Wed, 18 May 2022 13:49:35 -0500
Subject: [PATCH 4/6] Added Text to let user know to check both checkboxes
 Removed unwanted <br>

---
 app/templates/account/certify.html | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/templates/account/certify.html b/app/templates/account/certify.html
index 180ce52..928a755 100644
--- a/app/templates/account/certify.html
+++ b/app/templates/account/certify.html
@@ -97,11 +97,12 @@
             <label for="fullname" class="control-label">Full Name:</label>&#9;<input id="fullname" class="form-control" placeholder="Enter Full Name" required><br>
           </div>
           <div class="col-md-7 col-sm-7 my-col">
-            <label for="email" class="control-label">Email:</label>&#9;<input id="email" class="form-control" placeholder="Enter Email" required><br>
+            <label for="email" class="control-label">Email:</label>&#9;<input id="email" class="form-control" placeholder="Enter Email" required>
           </div>
           <div class="col-md-10 col-sm-10 my-col">
             <br><input class="checks" id ="agree1" type="checkbox" name="agree" value="agree" onchange= check() /> I have read & accept UAB IT's <a href="https://secure2.compliancebridge.com/uab/public/index.php?fuseaction=print.preview&docID=786" target="_blank">Acceptable Use Policy</a> and <a href="https://www.uab.edu/it/home/policies/data-classification/classification-overview" target="_blank">Data Classification Policy</a><br/>
             <br><input class="checks" id ="agree2" type="checkbox" name="agree" value="agree" onchange= check() /> I also understand that it is my responsibility to follow all relevant <a href="https://www.uab.edu/it/home/policies" target="_blank">IT policies</a> when using this resource.<br/>            
+            <br>To certify your account, both checkboxes must be checked.<br/>
             <button class="btn btn-danger btn-md" id="cancel" name="cancel" type="button" onClick="renderDom('Account  Certification Cancelled','{{ cancel_msg |safe }}', null)">Cancel</button> 
             <button class="btn btn-primary btn-md" disabled  id="submit" name="submit" type="button" value="Submit" onclick="displayloading1();certify_account()"> Certify Account</button>
           </div>
-- 
GitLab


From 054d1bd430eeba84f78fc002e79be77e077e0cb0 Mon Sep 17 00:00:00 2001
From: Krish M <krish94@uab.edu>
Date: Wed, 18 May 2022 14:44:23 -0500
Subject: [PATCH 5/6] code formatting

---
 app/__init__.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/app/__init__.py b/app/__init__.py
index e37cb6e..c8e1877 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -58,7 +58,9 @@ def create_app(config_name):
                                username=session['user'].get('username'),
                                fullname=session['user'].get('fullname'), email=session['user'].get('email'),
                                referrer=session['return_url'], cancel_url=vars.default_referrer,
-                               cancel_msg=messages.cancel_message, pre_certification_msg=messages.pre_certification_message, certification_msg=messages.certification_message)
+                               cancel_msg=messages.cancel_message, pre_certification_msg=messages.pre_certification_message, 
+                               certification_msg=messages.certification_message)
+
         else:
             return render_template('auth/SignUp.html', room_id=session['uid'],
                                username=session['user'].get('username'),
-- 
GitLab


From e63f9e2ec6f4930f1beab0507fee8fe61b72a236 Mon Sep 17 00:00:00 2001
From: Krish M <krish94@uab.edu>
Date: Wed, 18 May 2022 14:52:04 -0500
Subject: [PATCH 6/6] certify page formatting

---
 app/templates/account/certify.html | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/app/templates/account/certify.html b/app/templates/account/certify.html
index 928a755..c894eea 100644
--- a/app/templates/account/certify.html
+++ b/app/templates/account/certify.html
@@ -88,7 +88,7 @@
       </div>
     </div>
     <div id="user-recertify" style="display: none">
-    <p style="font-size:110%;"> {{ certification_msg |safe }}</p>
+    <p style="font-size:110%;"> {{ certification_msg |safe }}</p><br>
         <form id="signup" data-toggle="validator" role="form" action="." method="post" onsubmit="">
           <div class="col-md-7 col-sm-7 my-col">
             <label for="username" class="control-label">Blazer Id:</label>&#9;<input id="username" class="form-control" placeholder="Enter Username" required><br>
@@ -101,8 +101,7 @@
           </div>
           <div class="col-md-10 col-sm-10 my-col">
             <br><input class="checks" id ="agree1" type="checkbox" name="agree" value="agree" onchange= check() /> I have read & accept UAB IT's <a href="https://secure2.compliancebridge.com/uab/public/index.php?fuseaction=print.preview&docID=786" target="_blank">Acceptable Use Policy</a> and <a href="https://www.uab.edu/it/home/policies/data-classification/classification-overview" target="_blank">Data Classification Policy</a><br/>
-            <br><input class="checks" id ="agree2" type="checkbox" name="agree" value="agree" onchange= check() /> I also understand that it is my responsibility to follow all relevant <a href="https://www.uab.edu/it/home/policies" target="_blank">IT policies</a> when using this resource.<br/>            
-            <br>To certify your account, both checkboxes must be checked.<br/>
+            <input class="checks" id ="agree2" type="checkbox" name="agree" value="agree" onchange= check() /> I also understand that it is my responsibility to follow all relevant <a href="https://www.uab.edu/it/home/policies" target="_blank">IT policies</a> when using this resource.<br/>            
             <button class="btn btn-danger btn-md" id="cancel" name="cancel" type="button" onClick="renderDom('Account  Certification Cancelled','{{ cancel_msg |safe }}', null)">Cancel</button> 
             <button class="btn btn-primary btn-md" disabled  id="submit" name="submit" type="button" value="Submit" onclick="displayloading1();certify_account()"> Certify Account</button>
           </div>
-- 
GitLab