Commit 422da996 authored by Mitchell Moore's avatar Mitchell Moore Committed by Krish Moodbidri
Browse files

Added UAB OnDemand header, basic code cleanup, fixed redirect args to fix rerouting back to index

- Changed UAB OnDemand header and removed static folder
- Remove extra form fields
- Fixed user name population issue.
- Fixed redirect loop
- (fix) Prevent app from routing back to index
- Update readme
- (fix) Registration script call
- (fix) Jinja Version Update
- (fix) incorrect redir argument
- (fix) removed hardcoded return value
- Combine index and SignUp routes
- (fix) get redir args
- (fix) localize css elements
parent c5a1aa6f
......@@ -7,15 +7,17 @@ git clone
## Prerequisites
- Ensure `pip` is installed (see: )
- Install Flask using the `pip` command. Note, to install flask in your own `$HOME` use `pip install --user Flask`
- Ensure `pip` is installed (see: ).
- Ensure you have created a virtual environment called `venv` setup within the cloned project.
- Install Flask and other dependencies using the following:
pip install Flask
pip intall -p requirements.txt
- Note, to install flask in your own `$HOME` use `pip install --user Flask`.
## Starting the virtual machine for Flask
- Change to the `formWork` directory
- Change to the `flask_user_reg` directory.
- then start virtual machine:
source venv/bin/activate
......@@ -5,6 +5,7 @@ from __future__ import print_function
import os
import sys
import subprocess
# third-party imports
from flask import Flask, redirect, url_for, request
......@@ -16,6 +17,7 @@ def create_app(config_name):
app = Flask(__name__)
global return_url
return_url = ''
......@@ -24,34 +26,35 @@ def create_app(config_name):
global return_url
print(username, name, return_url, file=sys.stdout)
# Deliver arguments to script.
tempString = 'sudo user_create ' + username + " " + name
os.system("ssh ohpc " + tempString)
tempString = 'ssh ohpc "sudo /opt/ohpc_user_create/user_create ' + username + ' \'' + name + '\'"'
print(tempString, file=sys.stdout)
output = subprocess.check_output([tempString], shell=True)
print(output.split('\n')[7], file=sys.stdout)
return redirect(return_url, 302)
@app.route('/', methods=['GET'])
@app.route('/', methods=['GET', 'POST'])
def index():
global return_url
return_url = request.args.get("redir")
user = request.remote_user
return render_template("auth/SignUp.html", user=user, url=return_url)
if request.method == 'GET':
@app.route('/', methods=['GET', 'POST'])
def SignUp():
global return_url
name = request.form['name']
return_url = request.args.get("redir")[0] or "/pun/sys/dashboard"
user = request.remote_user
return render_template("auth/SignUp.html", user=user)
if request.method == 'GET':
if request.method == 'POST':
return render_template("auth/SignUp.html", user=user)
name = request.form['name']
if request.method == 'POST' and name != "":
if name != "":
return redirect(url_for('success', username=str(user), name=name))
This source diff could not be displayed because it is too large. You can view the blob instead.
<html class="gr__rc_uab_edu"><head>
<title>User Register</title>
<link rel="shortcut icon" type="image/x-icon" href="/public/favicon.ico">
<link rel="stylesheet" media="all" href="/static/style/application.css">
<link rel="stylesheet" media="all" href="/register/static/style/application.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
......@@ -14,26 +14,51 @@
<body data-gr-c-s-loaded="true">
<nav class="navbar navbar-inverse navbar-static-top">
<div class="container-fluid">
<nav class="navbar navbar-inverse navbar-static-top">
<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="/register">Research Computing</a>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9">
<ul class="nav navbar-nav">
<div class="navbar-right">
<ul class="nav navbar-nav">
</div><div class="container-fluid">
<div class="navbar-collapse collapse" id="bs-example-navbar-collapse-9" style="">
<a class="navbar-brand" href="/pun/sys/dashboard/">UAB Research Computing </a><div class="navbar-right">
<ul class="nav navbar-nav" style="float: right;">
<li class="dropdown" title="Help">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<span class="hidden-sm hidden-sm-nav"> Help</span>
<ul class="dropdown-menu">
<a target="_blank" href="">
<i class="fas fa-info-circle fa-fw"></i> Online Documentation
<a target="_self" href="/nginx/stop?redir=/pun/sys/dashboard/">
<i class="fas fa-sync fa-fw"></i> Restart Web Server
<ul class="nav navbar-nav" style="
float: right;
</div><ul class="nav navbar-nav">
<ul class="dropdown-menu">
......@@ -43,24 +68,13 @@
<div class="col-md-12">
<img class="header-logo" height="100" style="margin-bottom: 20px" <img="" src="/static/img/cheaha-logo-a605de0aecd3006b82a5ee30a6d0cb8cd9bf8b7e836296cc293eac746a4c2b11.png">
<h2>Hello user</h2>
<img class="header-logo" height="100" style="margin-bottom: 20px" src="/register/static/img/cheaha-logo-a605de0aecd3006b82a5ee30a6d0cb8cd9bf8b7e836296cc293eac746a4c2b11.png">
<h2>Hello, {{ user }}!</h2>
<form action="/" method="post">
<form action="." method="post">
<div class="signUpContainer">
<label for="name"><b>Full Name:<br></b></label>
<input class="form-control" type="text" placeholder="Enter Full Name" name="name">
<label for="email"><b>Email:<br></b></label>
<input class="form-control" type="text" placeholder="Enter Email Address" name="email">
<label for="institution"><b>Institution:<br></b></label>
<input class="form-control" type="text" placeholder="Enter Institution" name="institution">
<label for="sponsor"><b>Sponsor or Affiliation:<br></b></label>
<input class="form-control" type="text" placeholder="Enter Sponsor or Affiliation" name="sponsor">
<input class="btn btn-primary btn-block" type="submit" value="submit" onclick="return empty()">
......@@ -73,7 +87,7 @@
<div class="row">
<div class="col-md-6 col-sm-6">
<a href="">
<img class="footer-logo" alt="Powered by Open OnDemand" height="40" style="margin-bottom: 20px" src="/static/img/OpenOnDemand_powered_by_RGB-cb3aad5ff5350c7994f250fb334ddcc72e343233ce99eb71fda93beddd76a847.svg">
<img class="footer-logo" alt="Powered by Open OnDemand" height="40" style="margin-bottom: 20px" src="/register/static/img/OpenOnDemand_powered_by_RGB-cb3aad5ff5350c7994f250fb334ddcc72e343233ce99eb71fda93beddd76a847.svg">
......@@ -6,7 +6,7 @@ Flask-Login==0.4.1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment