Commit 12997516 authored by Krish Moodbidri's avatar Krish Moodbidri
Browse files

Feat certify account

1. Replaced function call rc_util.update_state with rc_util.certify_account
2. Added callback function for certify_account
parent 38dc5060
......@@ -35,6 +35,25 @@ def gen_f(room):
return callback
def certify_gen_f(room):
def callback(channel, method, properties, body):
msg = json.loads(body)
username = msg['username']
if msg['success']:
print(f'Account for {username} has been certified.')
send_msg('certified', room)
print(f"There's some issue while certifying account for {username}")
errmsg = msg.get('errmsg', [])
for err in errmsg:
socketio.emit('certify error', errmsg, room= room)
return callback
def send_msg(event, room):
socketio.emit(event, room=room)
......@@ -72,7 +91,7 @@ def celery_certify_account(json, session):
print("CERTIFY : "+time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + username + ' added to queue')
send_msg('certifying account', room)
rc_util.update_state(username, 'ok')
rc_util.certify_account(username, queuename, 'ok', 'all')
print('sent account info')
print('Waiting for certification...')
send_msg('certified', room)
rc_util.consume(queuename, routing_key=f'certified.{queuename}', callback=certify_gen_f(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