Skip to content
Snippets Groups Projects
Commit 7e1761fc authored by Mitchell Moore's avatar Mitchell Moore
Browse files

Feat check account existence

parent cd0c20ba
No related branches found
No related tags found
No related merge requests found
...@@ -9,3 +9,4 @@ dist/ ...@@ -9,3 +9,4 @@ dist/
build/ build/
*.egg-info/ *.egg-info/
**.idea/ **.idea/
**/.DS_Store
...@@ -6,10 +6,10 @@ from __future__ import print_function ...@@ -6,10 +6,10 @@ from __future__ import print_function
import os import os
import sys import sys
import subprocess import subprocess
import time
# third-party imports # third-party imports
from flask import Flask, redirect, url_for, request from flask import Flask, redirect, url_for, request, render_template, flash
from flask import render_template
from flask_bootstrap import Bootstrap from flask_bootstrap import Bootstrap
...@@ -53,18 +53,18 @@ def create_app(config_name): ...@@ -53,18 +53,18 @@ def create_app(config_name):
print(username, fullname, return_url, file=sys.stdout) print(username, fullname, return_url, file=sys.stdout)
# Deliver arguments to script. # Deliver arguments to script.
tempString = 'ssh ohpc "sudo /opt/ohpc_user_create/user_create ' + username + ' \'' + fullname + '\'"' tempString = 'ssh ohpc "sudo /opt/ohpc_user_create/user_create ' + username + " " + fullname + '"'
print(tempString, file=sys.stdout) print(tempString, file=sys.stdout)
output = subprocess.check_output([tempString], shell=True) try:
print(output.split('\n'), file=sys.stdout) subprocess.check_output([tempString], shell=True)
return redirect(return_url, 302)
return redirect(return_url, 302) except:
flash("Registration Failed")
return redirect(return_url)
# with app.test_request_context(
# '/', environ_base={'REMOTE_USER': 'short'}):
# pass
@app.errorhandler(403) @app.errorhandler(403)
def forbidden(error): def forbidden(error):
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
</nav> </nav>
</header> </header>
<div class="container content" role="main" style=" <div class="container content" role="main" style="
width: 800; width: 800;
"> ">
...@@ -50,13 +51,24 @@ ...@@ -50,13 +51,24 @@
<form action="." method="post"> <form action="." method="post">
<div class="signUpContainer"> <div class="signUpContainer">
<label for="name"><b>Full Name:<br></b></label> <label for="name"><b>Full Name:<br></b></label>
<input class="form-control" type="text" placeholder="Enter Full Name" name="name"> <input class="form-control" type="text" placeholder="Enter Full Name" name="name" required>
<input class="btn btn-primary btn-block" type="submit" value="submit"> <input class="btn btn-primary btn-block" type="submit" value="submit">
{% with messages = get_flashed_messages() %}
{% if messages %}
{% for message in messages %}
<div>
<strong style="color: #be051b; text-align: center;">{{ message }}</strong>
</div>
{% endfor %}
{% endif %}
{% endwith %}
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</body>
<footer> <footer>
<div class="container-fluid"> <div class="container-fluid">
...@@ -69,8 +81,4 @@ ...@@ -69,8 +81,4 @@
</div> </div>
</div><!-- /.container --> </div><!-- /.container -->
</footer> </footer>
</html>
</body></html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Registration Failed</title>
</head>
<body>
<h2>Something went wrong...</h2>
<p>
Redirecting back to sign-in page in 5 seconds.
</p>
</body>
</html>
\ No newline at end of file
...@@ -6,6 +6,7 @@ from app import create_app ...@@ -6,6 +6,7 @@ from app import create_app
config_name = os.getenv('FLASK_CONFIG') config_name = os.getenv('FLASK_CONFIG')
app = create_app(config_name) app = create_app(config_name)
app.secret_key = 'randomString'
if __name__ == '__main__': if __name__ == '__main__':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment