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/self-reg-form
  • louistw/self-reg-form
  • krish94/self-reg-form
3 results
Show changes
Commits on Source (78)
Showing
with 352 additions and 135 deletions
[flake8]
count = True
max-line-length = 79
show-source = True
statistics = True
exclude =
.git,
__pycache__,
venv
image: "python:3.7"
image: "python:3.6"
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip
- venv/
before_script:
- python --version
- pip install pylint
- python3 -m venv venv
- source venv/bin/activate
- pip install black==22.3.0 flake8==4.0.1 pylint==2.13.8
stages:
- lint
linting:
black:
tags:
- lint
stage: lint
script:
- black --check --diff .
only:
- merge_requests
flake8:
tags:
- lint
stage: lint
script:
- flake8 .
only:
- merge_requests
pylint:
tags:
- lint
stage: lint
script:
- pylint --ignore=tests.py --max-line-length=120 *.py app
- pylint app *.py
only:
- merge_requests
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 3.9.1
hooks:
- id: flake8
- repo: https://github.com/PyCQA/pylint
rev: v2.13.8
hooks:
- id: pylint
# Introduction
This is a flask application that leverages [RabbitMQ](https://www.rabbitmq.com/) and [Celery](https://docs.celeryproject.org/en/latest/getting-started/introduction.html)
to asynchronously create a Cheaha user account. Currently the project is being developed on an Openstack cluster.
# Project Setup
This is a flask application that leverages [RabbitMQ](https://www.rabbitmq.com/) and [Celery](https://docs.celeryproject.org/en/latest/getting-started/introduction.html)
to asynchronously create a Cheaha user account. Currently the project is being developed on an Openstack cluster.
# Project Setup
To clone this repo use the command:
To clone this repo use the command:
```
$ git clone https://gitlab.rc.uab.edu/mmoo97/flask_user_reg.git
$ cd flask_user_reg
```
## Prerequisites
## Prerequisites
### Setup a Virtual Environment
- Ensure you have created a [virtual environment](https://docs.python.org/3/library/venv.html)
- Ensure you have created a [virtual environment](https://docs.python.org/3/library/venv.html)
called `venv` setup running python3.
- Note, this project requires a virtual environment running __python3__ (__3.6.8__ in this case).
- Create this by navigating to you home directory via typing `$ cd` and entering the following commands:<br>
```
$ python3 -m venv ~/venv
$ source ~/venv
```
```
- Upon Activation, you should see the prompt update accordingly:
```
[centos@ood ~]$ <------Old Prompt
......@@ -46,7 +46,7 @@ $ pip install -r requirements.txt
- #### Mac/Linux
- `$ brew update`
- `$ brew install rabbitmq`
- it is recommended that you add the following line to your `.bash_profile`:
- it is recommended that you add the following line to your `.bash_profile`:
`export PATH=$PATH:/usr/local/opt/rabbitmq/sbin`.
- Start server using the command `$ rabbitmq-server`. (Note, this implementation assumes RabbitMQ is running on localhost on standard port 5672)
- #### Windows
......@@ -56,15 +56,37 @@ $ pip install -r requirements.txt
- First, import signing key using `$ rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc`
- Next, install Erlang using `$ yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm`
- Finally, install RabbitMq using `$ yum install rabbitmq-server-3.8.2-1.el8.noarch.rpm`
- The server is not started as a daemon by default when the RabbitMQ server package is installed. To start the
- The server is not started as a daemon by default when the RabbitMQ server package is installed. To start the
daemon by default when the system boots, as an administrator run: `$ chkconfig rabbitmq-server on`.
- As an administrator, start and stop the server as usual: <br/>`/sbin/service rabbitmq-server start`
- As an administrator, start and stop the server as usual: <br/>`/sbin/service rabbitmq-server start`
<br/> `/sbin/service rabbitmq-server stop`
- Add the user "reggie" using the command `$ rabbitmqctl add_user reggie reggie`.
- The current configuration assumes the following username password combination. To change the password, type
`$ rabbitmqctl change_password reggie <new_password>`.
- The current configuration assumes the following username password combination. To change the password, type
`$ rabbitmqctl change_password reggie <new_password>`.
- Note that rabbitmqctl may require sudo permissions and that changing the password will require a password
change in the credentials within `test_producer.py` and `base_consumer.py` as well.
### Setup pre commit hook
- via Homebrew(Mac)
```shell
brew install pre-commit
```
- via pip
```shell
pip install pre-commit
```
After pre-commit is installed, run install in the repo directory:
```shell
$ pre-commit install
> pre-commit installed at .git/hooks/pre-commit
```
# Run Project
## 1. Connect to OHPC/OOD
......@@ -75,11 +97,11 @@ $ pip install -r requirements.txt
2. Locate Floating Ip for each instance: <br>
![Research Computing Network](/docs/images/rc-network%20.png)<br>
According to this diagram of the network infrastructure, the IP Addresses that you will need to
According to this diagram of the network infrastructure, the IP Addresses that you will need to
connect to in order to ssh into each machine will be `164.111.161.xxx` where
`.xxx` is the last octet of your assigned Floating IP Addresses shown below.<br>
![Floating IP Addresses](/docs/images/floating_ips.png)<br>
Note that these numbers will typically vary depending on factors in the provisioning
Note that these numbers will typically vary depending on factors in the provisioning
process.
3. SSH into each machine: <br>
......@@ -90,21 +112,21 @@ $ pip install -r requirements.txt
```
4. Drop Firewall: <br>
Currently, the firewall prevents us from connecting to our soon to be running flask app.
Currently, the firewall prevents us from connecting to our soon to be running flask app.
To check if the firewall is active, type: <br>
`$ sudo systemctl status firewalld` <br>
`$ sudo systemctl status firewalld` <br>
In the case the firewall is still active, type: <br>
`$ sudo systemctl stop firewalld` <br>
In the case you need to turn the firewall back on, type: <br>
In the case you need to turn the firewall back on, type: <br>
`sudo systemctl start firewalld`
5. Edit Security Rules: <br>
5. Edit Security Rules: <br>
Lastly, we want to make sure that our network it open to run on our flask application
which runs on `localhost:5000` by default. Modify your __Default__ security group to
reflect the following rules: <br>
which runs on `localhost:5000` by default. Modify your __Default__ security group to
reflect the following rules: <br>
![Security Rules](/docs/images/security_rules.png) <br>
The main takeaway/modification in these rules is that traffic is allowed in and out of port 5000.
## 2. Initialize RabbitMQ
Make sure that you are running rabbitmq via the command `sudo rabbitmq server`.
......@@ -120,7 +142,7 @@ $ python base_consumer.py ohpc
You will notice that the script is awaiting a message to display.
To produce a message, run the following on the ood node terminal session:
```
$ python test_producer.py ohpc
$ python test_producer.py ohpc
```
You should now see that the message has been sent and displayed on the ohpc node.
......@@ -129,7 +151,7 @@ You should now see that the message has been sent and displayed on the ohpc node
In order to execute our tasks asychronously, we create a celery worker using the fllowing: <br>
`$ celery -A tasks worker --loglevel=info --concurrency=4 1> ~/celery.out 2> ~/celery.err &` <br><br>
In this case, the `celery -A tasks worker --loglevel=info --concurrency=4` portion of the command
is what is initiating the worker and the remainder serves to write the stdout and stderr to two separate files
is what is initiating the worker and the remainder serves to write the stdout and stderr to two separate files
located in the home directory and to run the process in the background. <br>
......@@ -138,15 +160,15 @@ Simply type `$ python run.py` <br>
Alternatively, type `$ python run.py > ~/flask.out 2> ~/flask.err &` to run the process in the background
and output to files in the home directory.
## 6. Check Job status
## 6. Check Job status
If all goes well, you should have your processes running in the background. Check the status of these by typing
`$ jobs`. You should now see the something similar to the following: <br>
If all goes well, you should have your processes running in the background. Check the status of these by typing
`$ jobs`. You should now see the something similar to the following: <br>
```
(venv) [centos@ood flask_user_reg]$ jobs
[1]- Running celery -A tasks worker --loglevel=info --concurrency=4 > ~/celery.out 2> ~/celery.err &
[2]+ Running python run.py > ~/server.out 2> ~/server.err &
(venv) [centos@ood flask_user_reg]$
(venv) [centos@ood flask_user_reg]$
```
## 7. Connect to Server
......@@ -157,5 +179,5 @@ address bar replacing `.xxx` with the final octet of the __OOD__ node. You shoul
- Fill out the form and hit "Submit"
- You should see an overlay signifying the account is being created. After 5 seconds it should disappear and signify the account creation has been successful.
- You can now enter the command `kill %1 %2` to terminate the celery worker and the flask server.
- You can view the output/errors of either the worker and flask server by opening `flask.out`, `flask.err`,
- You can view the output/errors of either the worker and flask server by opening `flask.out`, `flask.err`,
`celery.out`, or `celery.err`.
"""
Initialize the main flask app
"""
# app/__init__.py
# local imports
# standard imports
from __future__ import print_function
import vars
import messages
# third-party imports
import sys
import uuid
from flask import Flask, redirect, url_for, request, render_template, flash, session, send_from_directory
from flask_cors import CORS
# third-party imports
from flask import Flask, render_template, request, session
from flask_bootstrap import Bootstrap
import random
import os
import json
import sys
import re
from flask_cors import CORS
# local imports
import app_vars
import messages
sys.path.append(app_vars.rabbitmq_agents_loc)
# pylint: disable=wrong-import-order,wrong-import-position
import rc_util # noqa: E402
# pylint: enable=wrong-import-order,wrong-import-position
sys.path.append(vars.rabbitmq_agents_loc)
import rc_util
def create_app(config_name):
app = Flask(__name__, static_folder='static') # initialization of the flask app
cors = CORS(app, resources={r"/*": {"origins": vars.cors_allowed_origins}})
Bootstrap(app) # allowing app to use bootstrap
"""
Create main flask app
def get_authorized_user():
input:
config_name: environment of the app running
output:
Flask instance
"""
app = Flask(
__name__, static_folder="static"
) # initialization of the flask app
CORS(app, resources={r"/*": {"origins": app_vars.cors_allowed_origins}})
Bootstrap(app) # allowing app to use bootstrap
def get_authorized_user():
user = {
"username": re.search("([^!]+?)(@uab\.edu)?$", request.headers.get("Persistent-Id")).group(1),
"fullname": f'{request.headers.get("Givenname")} {request.headers.get("Sn")}',
"username": request.headers.get("REMOTE_USER"),
"fullname": request.headers.get("Displayname"),
"email": request.headers.get("Mail"),
"eppa": request.headers.get("Unscoped-Affiliation"),
}
return user
@app.route('/', methods=['GET', 'POST']) # initial route to display the reg page
@app.route(
"/", methods=["GET", "POST"]
) # initial route to display the reg page
def index():
valid_eppa = app_vars.valid_eppa
valid_eppa = vars.valid_eppa
if 'uid' not in session:
session['uid']=str(uuid.uuid4())
if "uid" not in session:
session["uid"] = str(uuid.uuid4())
if 'user' not in session:
if "user" not in session:
session["user"] = get_authorized_user()
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('account/unauthorized.html', unauthorized_message=messages.unauthorized_message)
if rc_util.check_state(session['user'].get('username')) == "blocked":
return render_template('account/blocked.html', unauthorized_message=messages.unauthorized_message)
elif rc_util.check_state(session['user'].get('username')) == "certification":
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,
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'),
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)
session["return_url"] = request.args.get(
"redir", app_vars.default_referrer
)
if "eppa" in request.headers:
if not any(
item in session["user"].get("eppa") for item in valid_eppa
):
return render_template(
"account/unauthorized.html",
unauthorized_msg=messages.unauthorized_message,
docs_url=app_vars.docs_url,
)
if rc_util.check_state(session["user"].get("username")) == "hold":
return render_template(
"account/hold.html",
account_hold_msg=messages.account_hold_message,
docs_url=app_vars.docs_url,
)
if (
rc_util.check_state(session["user"].get("username"))
== "certification"
or rc_util.check_state(session["user"].get("username"))
== "pre_certification"
):
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=app_vars.default_referrer,
cancel_msg=messages.cancel_message,
pre_certification_msg=messages.pre_certification_message,
certification_msg=messages.certification_message,
docs_url=app_vars.docs_url,
)
if rc_util.check_state(session["user"].get("username")) == "ok":
return render_template(
"account/good_standing.html",
good_standing_msg=messages.good_standing_message,
docs_url=app_vars.docs_url,
)
return render_template(
"auth/SignUp.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=app_vars.default_referrer,
welcome_msg=messages.welcome_message,
cancel_msg=messages.cancel_message,
error_msg=messages.error_message,
docs_url=app_vars.docs_url,
)
# misc page error catching
@app.errorhandler(403)
def forbidden(error):
return render_template('errors/403.html', title='Forbidden'), 403
return render_template("errors/403.html", title="Forbidden"), 403
@app.errorhandler(404)
def page_not_found(error):
return render_template('errors/404.html', title='Page Not Found'), 404
return render_template("errors/404.html", title="Page Not Found"), 404
@app.errorhandler(500)
def internal_server_error(error):
return render_template('errors/500.html', title='Server Error'), 500
return render_template("errors/500.html", title="Server Error"), 500
return app
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -9,11 +9,10 @@ function preCertification() {
}
}
function check() {
function check() {
var submitButton = document.getElementById("submit");
let ckbox1 = document.getElementById('agree1');
let ckbox2 = document.getElementById('agree2');
submitButton.disabled = !(ckbox1.checked && ckbox2.checked);
let ckbox = document.getElementById('agree');
submitButton.disabled = !(ckbox.checked);
};
function displayloading1() {
......@@ -50,7 +49,7 @@ function renderDom(title, message, error_msg) {
var error_button = document.createElement("BUTTON");
error_button.innerHTML = 'Read Error Message';
document.getElementById("form-wrapper").appendChild(error_button);
error_button.onclick = function(){document.getElementById("form-wrapper").innerHTML += "<br>" +error_msg}
error_button.onclick = function(){document.getElementById("form-wrapper").innerHTML += "<br>" +error_msg}
}
}
......
This diff is collapsed.
<html class="gr__rc_uab_edu">
<title>User Certification </title>
<title>Annual Account Certification</title>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.3/socket.io.min.js"></script>
......@@ -21,13 +21,16 @@
});
socket.on( 'certified', function( msg ) {
$('#myModal2').modal('hide');
window.location.replace('{{ referrer }}');
});
$('#myModal2 .modal-title').text("Account Certification Successful.");
$('#myModal2 .modal-body').text("Please allow 10-15 minutes for SSH access to be restored for your account. \nRedirecting...");
setTimeout(() => {
window.location.replace('{{ referrer }}');
}, 5000);
});
socket.on( 'certify error', function( msg ) {
console.log(msg);
$('#myModal2').modal('hide');
$('#myModal2').modal('hide');
renderDom("Account Certification Error", "{{ error_msg }}", msg);
});
......@@ -60,7 +63,7 @@
<div class="navbar-right">
<ul class="nav navbar-nav">
<li>
<a target="_blank" href="https://docs.uabgrid.uab.edu/wiki/Cheaha_GettingStarted">
<a target="_blank" href="{{ docs_url }}">
<i class="fas fa-info-circle fa-fw"></i> Online Documentation
</a>
</li>
......@@ -79,7 +82,7 @@
<div class="col-md-10 col-sm-10 my-col">
<div id="form-wrapper">
<h2> Annual Recertification</h2>
<h2> Annual Account Certification</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">
......@@ -88,7 +91,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>
......@@ -99,11 +102,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/>
<button class="btn btn-danger btn-md" id="cancel" name="cancel" type="button" onClick="renderDom('Account Certification Cancelled','{{ cancel_msg |safe }}', null)">Cancel</button>
<br><input class="checks" id ="agree" type="checkbox" name="agree" value="agree" onchange= check() /> I have read & accept UAB <a href="https://secure2.compliancebridge.com/uab/public/index.php?fuseaction=print.preview&docID=786" target="_blank">Acceptable Use</a>, <a href="https://www.uab.edu/it/home/policies/data-classification/classification-overview" target="_blank">Data Classification</a> and all other Information Technology <a href="https://www.uab.edu/it/home/policies" target="_blank">Policies.</a><br/>
<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>
</form>
......@@ -111,7 +112,7 @@
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="overlayModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog modal-sm" role="document">
......
<html class="gr__rc_uab_edu">
<title>User Blocked </title>
<title>Good Standing </title>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.3/socket.io.min.js"></script>
......@@ -33,7 +33,7 @@
<div class="navbar-right">
<ul class="nav navbar-nav">
<li>
<a target="_blank" href="https://docs.uabgrid.uab.edu/wiki/Cheaha_GettingStarted">
<a target="_blank" href="{{ docs_url }}">
<i class="fas fa-info-circle fa-fw"></i> Online Documentation
</a>
</li>
......@@ -52,11 +52,11 @@
<div class="col-md-10 col-sm-10 my-col">
<div id="form-wrapper">
<h2> Account blocked </h2>
<p style="font-size:110%;"> {{ unauthorized_message |safe }}</p>
<h2> Account in Good Standing </h2>
<p style="font-size:110%;"> {{ good_standing_msg|safe }}</p>
</div>
</div>
</div>
</div>
<footer>
<div class="container-fluid">
......
<html class="gr__rc_uab_edu">
<title>Account On Hold</title>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.3/socket.io.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
<script src="{{ url_for('static', filename='scripts/function.js') }}"></script>
<link rel="shortcut icon" type="image/x-icon" href="/public/favicon.ico">
<link rel="stylesheet" media="all" href="{{ url_for('static', filename='style/application.css') }}">
<link rel="stylesheet" media="all" href="{{ url_for('static', filename='style/app2.css') }}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.navbar-inverse { background-color: rgb(0,99,65); }
button{ margin: 13px;
.important { color: #336699; }}
</style>
</head>
<body data-gr-c-s-loaded="true">
<header>
<nav class="navbar navbar-inverse navbar-static-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-9" aria-expanded="false"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
<a class="navbar-brand" href="/"> UAB Research Computing</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9">
<div class="navbar-right">
<ul class="nav navbar-nav">
<li>
<a target="_blank" href="{{ docs_url }}">
<i class="fas fa-info-circle fa-fw"></i> Online Documentation
</a>
</li>
</ul>
</div>
</div>
</div>
</nav>
</header>
<div class="container content" role="main" style="width: 100%">
<div class="col-md-2 col-sm-2 my-col">
<img alt="logo" height="auto" width="80%" src="{{ url_for('static', filename='img/logo_svg.svg') }}">
<a href="https://tinyurl.com/cheahaAL" target="_blank"></a>
</div>
<div class="col-md-10 col-sm-10 my-col">
<div id="form-wrapper">
<h2> Account On Hold </h2>
<p style="font-size:110%;"> {{ account_hold_msg |safe }}</p>
</div>
</div>
</div>
<footer>
<div class="container-fluid">
<div class="row">
<div class="col-md-6 col-sm-6">
<a href="https://osc.github.io/Open-OnDemand/">
<img class="footer-logo" alt="Powered by Open OnDemand" height="40" style="margin-bottom: 20px" src="{{ url_for('static', filename='img/OpenOnDemand_powered_by_RGB-cb3aad5ff5350c7994f250fb334ddcc72e343233ce99eb71fda93beddd76a847.svg') }}">
</a>
</div>
</div>
</div>
</footer>
</body>
</html>
<html class="gr__rc_uab_edu">
<title>User Authorization error </title>
<title> Account Unauthorized </title>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.3/socket.io.min.js"></script>
......@@ -33,7 +33,7 @@
<div class="navbar-right">
<ul class="nav navbar-nav">
<li>
<a target="_blank" href="https://docs.uabgrid.uab.edu/wiki/Cheaha_GettingStarted">
<a target="_blank" href="{{ docs_url }}">
<i class="fas fa-info-circle fa-fw"></i> Online Documentation
</a>
</li>
......@@ -52,11 +52,11 @@
<div class="col-md-10 col-sm-10 my-col">
<div id="form-wrapper">
<h2> Account Authorization error </h2>
<p style="font-size:110%;"> {{ unauthorized_message |safe }}</p>
<h2> Account Unauthorized </h2>
<p style="font-size:110%;"> {{ unauthorized_msg |safe }}</p>
</div>
</div>
</div>
</div>
<footer>
<div class="container-fluid">
......
......@@ -21,12 +21,16 @@
});
socket.on( 'account ready', function( msg ) {
window.location.replace('{{ referrer }}');
$('#myModal2 .modal-title').text("Account Creation Successful");
$('#myModal2 .modal-body').text("Redirecting...");
setTimeout(() => {
window.location.replace('{{ referrer }}');
}, 5000);
});
socket.on( 'account error', function( msg ) {
console.log(msg);
$('#myModal2').modal('hide');
$('#myModal2').modal('hide');
renderDom("Account Create Error", "{{ error_msg |safe}}", msg);
});
......@@ -59,7 +63,7 @@
<div class="navbar-right">
<ul class="nav navbar-nav">
<li>
<a target="_blank" href="https://docs.uabgrid.uab.edu/wiki/Cheaha_GettingStarted">
<a target="_blank" href="{{ docs_url }}">
<i class="fas fa-info-circle fa-fw"></i> Online Documentation
</a>
</li>
......@@ -80,7 +84,7 @@
<div id="form-wrapper">
<h2>Welcome to UAB Research Computing</h2>
<p style="font-size:110%;"> {{ welcome_msg |safe }}</p>
<div id="user-input">
<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">
<label for="username" class="control-label">Blazer Id:</label>&#9;<input id="username" class="form-control" placeholder="Enter Username" required><br>
......@@ -93,21 +97,18 @@
</div>
<div class="col-md-7 col-sm-7 my-col">
<label for="reason" class="control-label">Reason for Requesting Account:</label><br>
<textarea class="form-control" id="reason" name="reason" placeholder="Enter Reason for Account Request" required></textarea>
<textarea class="form-control" id="reason" name="reason" placeholder="Enter Reason for Account Request" required></textarea><br>
</div>
<br>
<div class="col-md-7 col-sm-7 my-col">
<!--
<br><input class="checks" id ="agree" type="checkbox" name="agree" value="agree" onchange= check() />Agree to proceed<br/>
--!>
<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-primary btn-md" id="submit" name="submit" type="button" value="Submit" onclick="displayloading1();request_account()"> Create Account</button>
<div class="col-md-10 col-sm-10 my-col">
<br><input class="checks" id ="agree" type="checkbox" name="agree" value="agree" onchange= check() /> I have read & accept UAB <a href="https://secure2.compliancebridge.com/uab/public/index.php?fuseaction=print.preview&docID=786" target="_blank">Acceptable Use</a>, <a href="https://www.uab.edu/it/home/policies/data-classification/classification-overview" target="_blank">Data Classification</a> and all other Information Technology <a href="https://www.uab.edu/it/home/policies" target="_blank">Policies.</a><br/>
<br><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-primary btn-md" disabled id="submit" name="submit" type="button" value="Submit" onclick="displayloading1();request_account()"> Create Account</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="overlayModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog modal-sm" role="document">
......
......@@ -11,4 +11,4 @@
You will be emailed as soon as your request has been fulfilled.
</p>
</body>
</html>
\ No newline at end of file
</html>
......@@ -12,4 +12,4 @@
</body>
</html>
\ No newline at end of file
</html>
......@@ -9,4 +9,4 @@
<p>Page Not Found</p>
</body>
</html>
\ No newline at end of file
</html>
......@@ -9,4 +9,4 @@
<p>Internal Server Error</p>
</body>
</html>
\ No newline at end of file
</html>
"""
Define different environment running the app
"""
# config.py
......@@ -34,8 +38,7 @@ class TestingConfig(Config):
app_config = {
'development': DevelopmentConfig,
'production': ProductionConfig,
'testing': TestingConfig
"development": DevelopmentConfig,
"production": ProductionConfig,
"testing": TestingConfig,
}