mirror of https://github.com/zulip/zulip.git
confirmation: Use expiry_date to verify validity.
This commit is contained in:
parent
18ad18c025
commit
de5fc7826b
|
@ -70,8 +70,7 @@ def get_object_from_key(
|
||||||
except Confirmation.DoesNotExist:
|
except Confirmation.DoesNotExist:
|
||||||
raise ConfirmationKeyException(ConfirmationKeyException.DOES_NOT_EXIST)
|
raise ConfirmationKeyException(ConfirmationKeyException.DOES_NOT_EXIST)
|
||||||
|
|
||||||
time_elapsed = timezone_now() - confirmation.date_sent
|
if timezone_now() > confirmation.expiry_date:
|
||||||
if time_elapsed.total_seconds() > _properties[confirmation.type].validity_in_days * 24 * 3600:
|
|
||||||
raise ConfirmationKeyException(ConfirmationKeyException.EXPIRED)
|
raise ConfirmationKeyException(ConfirmationKeyException.EXPIRED)
|
||||||
|
|
||||||
obj = confirmation.content_object
|
obj = confirmation.content_object
|
||||||
|
|
Loading…
Reference in New Issue