Commit e9e8a0f3 authored by Ravi Tripathi's avatar Ravi Tripathi Committed by Krish Moodbidri
Browse files

Remove username value added, as well as the parameter username passed in...

Remove username value added, as well as the parameter username passed in render_template. Code cleanup

- Remove username value added, as well as the parameter username passed in render_template
- Removing unused functions and commented out lines
parent bf375ed9
...@@ -15,17 +15,13 @@ def create_app(config_name): ...@@ -15,17 +15,13 @@ def create_app(config_name):
@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(): def index():
if 'username' not in session:
session['username'] = "name_test" + str(random.randint(0, 10000))
# session['username'] = request.remote_user
if 'uid' not in session: if 'uid' not in session:
session['uid']=str(uuid.uuid4()) session['uid']=str(uuid.uuid4())
if "redir" in request.args and 'return_url' not in session: # check for redir arg in url if "redir" in request.args and 'return_url' not in session: # check for redir arg in url
session['return_url'] = request.args.get("redir") or "/pun/sys/dashboard" session['return_url'] = request.args.get("redir") or "/pun/sys/dashboard"
return render_template('auth/SignUp.html', user=session['username'], room_id=session['uid']) return render_template('auth/SignUp.html', room_id=session['uid'])
@app.errorhandler(403) @app.errorhandler(403)
def forbidden(error): def forbidden(error):
......
...@@ -11,9 +11,6 @@ ...@@ -11,9 +11,6 @@
var socket = io.connect('http://' + document.domain + ':' + location.port); var socket = io.connect('http://' + document.domain + ':' + location.port);
socket.on( 'connect', function() { socket.on( 'connect', function() {
/* socket.emit( 'user connected', {
user: document.getElementById("username").innerText
} ) */
socket.emit( 'join_room' ) socket.emit( 'join_room' )
socket.on( 'creating account', function( msg ) { socket.on( 'creating account', function( msg ) {
......
...@@ -7,10 +7,8 @@ from gevent import monkey ...@@ -7,10 +7,8 @@ from gevent import monkey
monkey.patch_all(subprocess=True) monkey.patch_all(subprocess=True)
broker_url = 'amqp://reggie:reggie@ohpc:5672/' broker_url = 'amqp://reggie:reggie@ohpc:5672/'
#broker_url = 'amqp://'
celery = Celery('flask_user_reg', broker=broker_url) celery = Celery('flask_user_reg', broker=broker_url)
#socketio = SocketIO(message_queue='amqp:///socketio')
socketio = SocketIO(message_queue='amqp://reggie:reggie@ohpc:5672/socketio') socketio = SocketIO(message_queue='amqp://reggie:reggie@ohpc:5672/socketio')
def send_msg(event, room): def send_msg(event, room):
...@@ -20,14 +18,9 @@ def send_msg(event, room): ...@@ -20,14 +18,9 @@ def send_msg(event, room):
@celery.task @celery.task
def celery_create_account(username, fullname, reason, session): def celery_create_account(username, fullname, reason, session):
room = session room = session
# Todo: Ravi's and Louis's code goes here
print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + username + ' added to queue') print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + username + ' added to queue')
send_msg('creating account', room) send_msg('creating account', room)
#socketio.emit("creating account", room=room)
print(username) print(username)
subprocess.call(["/opt/rabbitmq_agents/flask_producer.py", "ohpc_account_create", username]) subprocess.call(["/opt/rabbitmq_agents/flask_producer.py", "ohpc_account_create", username])
#time.sleep(5)
print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tAccount successfully created for ' + username) print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tAccount successfully created for ' + username)
send_msg('account ready', room) send_msg('account ready', room)
#socketio.emit('account ready', room=room)
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