Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • rc/account-app
  • louistw/account-app
  • krish94/self-reg-form
  • dwheel7/self-reg-form
  • dwheel7/feature-reanme-self-reg-app-to-account-app
  • atlurie/account-app
  • dwheel7/account-app
7 results
Show changes
Commits on Source (17)
......@@ -13,6 +13,7 @@ import random
import os
import json
import sys
import re
sys.path.append(vars.rabbitmq_agents_loc)
import rc_util
......@@ -23,16 +24,12 @@ def create_app(config_name):
Bootstrap(app) # allowing app to use bootstrap
def get_authorized_user():
username_key = list(filter(lambda key: (request.headers.get(key) is not None), vars.username_key))
fullname_key = list(filter(lambda key: (request.headers.get(key) is not None), vars.fullname_key))
email_key = list(filter(lambda key: (request.headers.get(key) is not None), vars.email_key))
eppa_key = list(filter(lambda key: (request.headers.get(key) is not None), vars.eppa_key))
user = {
"username": (request.headers.get(username_key[0]) if len(username_key) > 0 else None),
"fullname": (request.headers.get(fullname_key[0]) if len(fullname_key) > 0 else None),
"email": (request.headers.get(email_key[0]) if len(email_key) > 0 else None),
"eppa": (request.headers.get(eppa_key[0]) if len(eppa_key) > 0 else None),
"username": re.search("([^!]+?)(@uab\.edu)?$", request.headers.get("Persistent-Id")).group(1),
"fullname": f'{request.headers.get("Givenname")} {request.headers.get("Sn")}',
"email": request.headers.get("Mail"),
"eppa": request.headers.get("Unscoped-Affiliation"),
}
return user
......@@ -51,19 +48,17 @@ def create_app(config_name):
session['return_url'] = request.args.get('redir', vars.default_referrer)
if (not any(item in session['user'].get('eppa') for item in valid_eppa)):
return render_template('errors/shibboleth.html')
return render_template('account/unauthorized.html', unauthorized_message=messages.unauthorized_message)
if rc_util.check_state(session['user'].get('username')) == "blocked":
return render_template('errors/blocked.html')
return render_template('account/blocked.html', unauthorized_message=messages.unauthorized_message)
elif rc_util.check_state(session['user'].get('username')) == "certification":
return render_template('errors/certify.html', room_id=session['uid'],
return render_template('account/certify.html', room_id=session['uid'],
username=session['user'].get('username'),
fullname=session['user'].get('fullname'), email=session['user'].get('email'),
referrer=session['return_url'], cancel_url=vars.default_referrer,
welcome_msg=messages.welcome_message,
cancel_msg=messages.cancel_message,
error_msg=messages.error_message)
cancel_msg=messages.cancel_message, certification_message=messages.certification_message)
else:
return render_template('auth/SignUp.html', room_id=session['uid'],
username=session['user'].get('username'),
......@@ -73,14 +68,6 @@ def create_app(config_name):
cancel_msg=messages.cancel_message,
error_msg=messages.error_message)
@app.route('/blocked_account')
def account_block():
return render_template('errors/blocked.html')
@app.route('/certify_account')
def error_certify():
return render_template('errors/certify.html')
# misc page error catching
@app.errorhandler(403)
def forbidden(error):
......
......@@ -53,7 +53,7 @@
<div class="col-md-10 col-sm-10 my-col">
<div id="form-wrapper">
<h2> Account blocked </h2>
<p style="font-size:110%;"> {{ welcome_msg |safe }}</p>
<p style="font-size:110%;"> {{ unauthorized_message |safe }}</p>
</div>
</div>
</div>
......
......@@ -79,8 +79,8 @@
<div class="col-md-10 col-sm-10 my-col">
<div id="form-wrapper">
<h2> Self Certification Form </h2>
<p style="font-size:110%;"> {{ welcome_msg |safe }}</p>
<h2> Annual Recertification Form </h2>
<p style="font-size:110%;"> {{ certification_message |safe }}</p>
<div id="user-input">
<form id="signup" data-toggle="validator" role="form" action="." method="post" onsubmit="">
<div class="col-md-7 col-sm-7 my-col">
......@@ -94,7 +94,7 @@
</div>
<br>
<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 Creation Cancelled','{{ cancel_msg |safe }}', null)">Cancel</button>
<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>
</div>
</form>
......
......@@ -53,7 +53,7 @@
<div class="col-md-10 col-sm-10 my-col">
<div id="form-wrapper">
<h2> Account Authorization error </h2>
<p style="font-size:110%;"> {{ welcome_msg |safe }}</p>
<p style="font-size:110%;"> {{ unauthorized_message |safe }}</p>
</div>
</div>
</div>
......
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."
......@@ -11,7 +11,7 @@ sys.path.append(vars.rabbitmq_agents_loc)
import rc_util
broker_url = vars.broker_url
celery = Celery('flask_user_reg', broker=broker_url)
celery = Celery(vars.celery_app, broker=broker_url)
socketio = SocketIO(message_queue=vars.message_queue)
timeout = 30
......@@ -20,7 +20,7 @@ def gen_f(room):
def callback(channel, method, properties, body):
msg = json.loads(body)
username = msg['username']
queuename = msg['username']
queuename = msg['queuename']
if msg['success']:
print(f'Account for {username} has been created.')
......@@ -40,7 +40,7 @@ def certify_gen_f(room):
def callback(channel, method, properties, body):
msg = json.loads(body)
username = msg['username']
queuename = msg['username']
queuename = msg['queuename']
if msg['success']:
print(f'Account for {username} has been certified.')
......