Commit 2124c09b authored by Mitchell Moore's avatar Mitchell Moore Committed by Krish Moodbidri
Browse files

Followed variable convention in Signup.html and function.js, added overlay as a function in js

- Added overlay as a function
- Clean whitespace in Signup.html
- Fix variable convention
parent 01ad7219
function displayloading() {
document.getElementById("notification_window").innerHTML = "" +
"<div class=\"joyride-tip-guide\" data-index=\"0\" style=\"visibility: visible; display: block; top: 77.5px; left: 570px;\"><span class=\"joyride-nub\" style=\"display: none;\"></span><div class=\"joyride-content-wrapper\" role=\"dialog\"><ol>\n" +
" <h4>\n" +
"\n" +
" Your account is pending creation...\n" +
"\n" +
" </h4>\n" +
" <br><p>\n" +
" This can take between 5-10 min.\n" +
" </p>\n" +
" </ol>\n" +
" <img src=\"/static/img/loading.gif\" style=\"width: 35px; height: auto\"> Pending...\n" +
" </div></div>\n" +
"\n" +
" <div class=\"joyride-modal-bg\" style=\"display: block;\"></div>"
}
function request_account() {
socket.emit('request account', {
fullname: document.getElementById("fullname").value,
reason: document.getElementById("reason").value,
username: document.getElementById("username").innerText
})
}
function refresh() {
document.location.reload(true);
}
\ No newline at end of file
<!DOCTYPE html> <html class="gr__rc_uab_edu">
<html> <title>User Registration </title>
<body> <head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<h2>Sign up Form</h2> <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.3/socket.io.min.js"></script>
<script src="static/scripts/function.js"></script>
<form action="/" method="post"> <script src="static/scripts/function.js"></script>
<div class ="signUpContainer">
<label for="email"><b>Email:<br></b></label> <script>
<input type="email" placeholder="Enter Email" name="email" onkeyup='validateEmail(email);' required/><br> var socket = io.connect('http://' + document.domain + ':' + location.port);
<label>password : <br> socket.on( 'connect', function() {
<input name="password" placeholder="Enter Password" id="password" type="password" onkeyup='check();' required /> socket.emit( 'user connect', {
</label>` user: document.getElementById("username").innerText
<br> } )
<label>confirm password: <br>
<input type="password" placeholder="Re-enter Password" name="confirm_password" id="confirm_password" onkeyup='check();' required/> socket.on( 'creating account', function( msg ) {
<span id='message'></span> document.getElementById("error").innerText = "";
</label>`<br> displayloading();
<input type="submit" value = "Submit" ></input> socket.emit("validate creation", {
<script> username: document.getElementById("username").innerText
var check = function() { })
if (document.getElementById('password').value == })
document.getElementById('confirm_password').value) {
document.getElementById('message').style.color = 'green'; socket.on( 'Account creation failed', function( msg ) {
document.getElementById('message').innerHTML = 'matching'; document.getElementById("error").innerText = "Registration Failed. Please try again.";
} else { })
document.getElementById('message').style.color = 'red';
document.getElementById('message').innerHTML = 'not matching';
} socket.on( 'Account created', function( msg ) {
} let element = document.getElementById("notification_window");
function validateEmail() { element.parentNode.removeChild(element);
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; element.innerHTML = " ";
return re.test(String(email).toLowerCase()); alert("Account creation successful!");
}
})
})
</script> </script>
<style type="text/css">
.important { color: #336699; }
</style>
<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="/static/style/app2.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.navbar-inverse {
background-color: rgb(0,99,65);
}
</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="/">Research Computing</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9">
<ul class="nav navbar-nav">
</ul>
<div class="navbar-right">
<ul class="nav navbar-nav">
<li>
<a target="_blank" href="https://docs.uabgrid.uab.edu/wiki/Cheaha_GettingStarted">
<i class="fas fa-info-circle fa-fw"></i> Online Documentation
</a></li>
<li>
</li></ul>
</div>
</div>
</div>
</nav>
</header>
<div class="container content" role="main" style="width: 625px">
<div style="position:relative;">
<img alt="logo" height="100" style="margin-bottom: 20px" src="/static/img/cheaha-logo-a605de0aecd3006b82a5ee30a6d0cb8cd9bf8b7e836296cc293eac746a4c2b11.png">
<a href="https://tinyurl.com/cheahaAL" target="_blank">
<div style="float:left;position:absolute;display:block;left:310px;top:-6px;padding:10px 20px;"> </div>
</a>
</div>
<h2>Hello, <span id="username">{{ user }}</span>!</h2>
<div id="test">
<form action="." method="post" onsubmit="">
<div class="signUpContainer">
<label><b><label for="fullname">Full Name: </label><br></b></label>
<input class="form-control" id="fullname" name="fullname" placeholder="Enter Full Name" required="" type="text">
<label><b><label for="reason">Reason for Requesting Account: </label><br></b></label>
<textarea class="form-control" id="reason" name="reason" placeholder="Enter Reason for Account Request" required=""></textarea>
<input class="btn btn-primary btn-block" id="submit" name="submit" type="button" value="Submit" onclick="request_account()">
<div>
<strong id="error" style="color: #be051b; text-align: center;"></strong>
</div>
</div>
</form>
</div>
</div> </div>
</form> </form>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import os import os
import time import time
import subprocess
import pika import pika
from flask_socketio import SocketIO from flask_socketio import SocketIO
...@@ -49,7 +50,6 @@ def create_account(username, fullname, reason): ...@@ -49,7 +50,6 @@ def create_account(username, fullname, reason):
def account_confirmation(username): def account_confirmation(username):
# Todo: Code to create a consumer based on the username goes here # Todo: Code to create a consumer based on the username goes here
# Todo: Goal is to have it listening for confirmation. # Todo: Goal is to have it listening for confirmation.
time.sleep(5)
return True return True
...@@ -59,7 +59,7 @@ def handle_my_custom_event(json, methods=['GET', 'POST']): ...@@ -59,7 +59,7 @@ def handle_my_custom_event(json, methods=['GET', 'POST']):
print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + username + ' connected.') print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + username + ' connected.')
@socketio.on('user data') @socketio.on('request account')
def ingest_data(json, methods=['GET', 'POST']): def ingest_data(json, methods=['GET', 'POST']):
print (time.strftime("%m-%d-%Y_%H:%M:%S") + '\tQueue request received: ' + str(json)) print (time.strftime("%m-%d-%Y_%H:%M:%S") + '\tQueue request received: ' + str(json))
......
Supports Markdown
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