Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
1 merge request!3Feat certify account
......@@ -35,6 +35,25 @@ def gen_f(room):
rc_util.rc_rmq.delete_queue()
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)
else:
print(f"There's some issue while certifying account for {username}")
errmsg = msg.get('errmsg', [])
for err in errmsg:
print(err)
socketio.emit('certify error', errmsg, room= room)
rc_util.rc_rmq.stop_consume()
rc_util.rc_rmq.delete_queue()
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)
print(username)
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))
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