Comnplete links afterb sign up
This commit is contained in:
@@ -396,13 +396,17 @@ def verify_register():
|
|||||||
}
|
}
|
||||||
user_uid = data['user']['uid']
|
user_uid = data['user']['uid']
|
||||||
#'a4b75649-e3c5-424f-bcdb-5481e625d24b'
|
#'a4b75649-e3c5-424f-bcdb-5481e625d24b'
|
||||||
FIND_USER_DETAIL= "SELECT email, firstname,lastname,uid FROM members_pending WHERE uid::text = '"+user_uid+"'"
|
FIND_USER_DETAIL= "SELECT email, firstname,lastname,uid FROM members_pending WHERE status = 0 AND uid::text = '"+user_uid+"'"
|
||||||
print(FIND_USER_DETAIL)
|
print(FIND_USER_DETAIL)
|
||||||
with connection:
|
with connection:
|
||||||
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
||||||
cursor.execute(FIND_USER_DETAIL)
|
cursor.execute(FIND_USER_DETAIL)
|
||||||
account = cursor.fetchall()
|
account = cursor.fetchall()
|
||||||
print(account[0])
|
# print(account[0])
|
||||||
|
|
||||||
|
account_found = count = len( account )
|
||||||
|
if account_found > 0 :
|
||||||
|
return jsonify({'status': "INVALID",'message': 'Error - Invalid sign up link'}), 403
|
||||||
|
|
||||||
accountRes = json.dumps( [dict(ix) for ix in account] )
|
accountRes = json.dumps( [dict(ix) for ix in account] )
|
||||||
user_array = json.loads(accountRes)
|
user_array = json.loads(accountRes)
|
||||||
@@ -441,11 +445,12 @@ def complete_register():
|
|||||||
#print(user_search[0][0])
|
#print(user_search[0][0])
|
||||||
account_id = count = len( user_search )
|
account_id = count = len( user_search )
|
||||||
if account_id > 0 :
|
if account_id > 0 :
|
||||||
return jsonify({'status': "DUPLICATE",'message': 'Error - use another username'}), 200
|
return jsonify({'status': "DUPLICATE",'message': 'Error - use another username'}), 403
|
||||||
|
|
||||||
user_uid = pending_data['user']['uid']
|
user_uid = pending_data['user']['uid']
|
||||||
#'a4b75649-e3c5-424f-bcdb-5481e625d24b'
|
#'a4b75649-e3c5-424f-bcdb-5481e625d24b'
|
||||||
FIND_USER_DETAIL= "SELECT firstname,lastname,email, uid FROM members_pending WHERE uid::text = '"+user_uid+"'"
|
FIND_USER_DETAIL = "SELECT firstname,lastname,email, uid FROM members_pending WHERE uid::text = '"+user_uid+"'"
|
||||||
|
COMPLETE_PENDING = "UPDATE members_pending SET status = 5 WHERE status IN (0,1,2) AND uid::text = '"+user_uid+"'"
|
||||||
with connection:
|
with connection:
|
||||||
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
||||||
cursor.execute(FIND_USER_DETAIL)
|
cursor.execute(FIND_USER_DETAIL)
|
||||||
@@ -465,6 +470,7 @@ def complete_register():
|
|||||||
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
||||||
cursor.execute(CREATE_USER,create_values)
|
cursor.execute(CREATE_USER,create_values)
|
||||||
connection.commit()
|
connection.commit()
|
||||||
|
cursor.execute(COMPLETE_PENDING)
|
||||||
|
|
||||||
member = Members().login(
|
member = Members().login(
|
||||||
username,
|
username,
|
||||||
|
|||||||
Reference in New Issue
Block a user