|
|
@ -918,8 +918,12 @@ def invalidate_token(refresh_token): |
|
|
|
|
|
|
|
|
|
|
|
def update_tokens_in_doc(user_email, access, refresh): |
|
|
|
access_exp_hours = 15 * 60 |
|
|
|
refresh_exp_hrs = 60 * 60 * 24 |
|
|
|
# access_exp_hours = 15 * 60 |
|
|
|
# refresh_exp_hrs = 60 * 60 * 24 |
|
|
|
|
|
|
|
token_settings = frappe.get_doc('Token Settings') |
|
|
|
access_exp_hours = token_settings.access_expiry_time |
|
|
|
refresh_exp_hrs = token_settings.refresh_expiry_time |
|
|
|
|
|
|
|
user_token_details = {} |
|
|
|
|
|
|
@ -938,8 +942,11 @@ def update_tokens_in_doc(user_email, access, refresh): |
|
|
|
refresh_doc.access_token = encrypt(access) |
|
|
|
refresh_doc.refresh_token = encrypt(refresh) |
|
|
|
|
|
|
|
access_exp_time = datetime.now() + timedelta(seconds=access_exp_hours) |
|
|
|
refresh_exp_time = datetime.now() + timedelta(seconds=refresh_exp_hrs) |
|
|
|
# access_exp_time = datetime.now() + timedelta(seconds=access_exp_hours) |
|
|
|
# refresh_exp_time = datetime.now() + timedelta(seconds=refresh_exp_hrs) |
|
|
|
|
|
|
|
access_exp_time = datetime.now() + timedelta(minutes=access_exp_hours) |
|
|
|
refresh_exp_time = datetime.now() + timedelta(hours=refresh_exp_hrs) |
|
|
|
|
|
|
|
refresh_doc.access_expiry_time = access_exp_time |
|
|
|
refresh_doc.refresh_expiry_time = refresh_exp_time |
|
|
@ -990,8 +997,11 @@ def deactivate_tokens(): |
|
|
|
rate_res = custom_rate_limit(limit=5, seconds=15) |
|
|
|
if rate_res != 1: |
|
|
|
return rate_res |
|
|
|
access_exp_hours = 15 * 60 |
|
|
|
access_exp_time = datetime.now() + timedelta(seconds=access_exp_hours) |
|
|
|
token_settings = frappe.get_doc('Token Settings') |
|
|
|
access_exp_hours = token_settings.access_expiry_time |
|
|
|
|
|
|
|
# access_exp_hours = 15 * 60 |
|
|
|
access_exp_time = datetime.now() + timedelta(minutes=access_exp_hours) |
|
|
|
frappe.set_user("Administrator") |
|
|
|
doc_details = frappe.db.sql(''' |
|
|
|
SELECT * FROM `tabRefresh Token`;''', as_dict=1) |
|
|
|