def confirm(self, confirmation_key): if B16_RE.search(confirmation_key): try: confirmation = self.get(confirmation_key=confirmation_key) except self.model.DoesNotExist: return False obj = confirmation.content_object status_field = get_status_field(obj._meta.app_label, obj._meta.model_name) setattr(obj, status_field, getattr(settings, 'STATUS_ACTIVE', 1)) obj.save() return obj return False
def confirm(self, confirmation_key): if B16_RE.search(confirmation_key): try: confirmation = self.get(confirmation_key=confirmation_key) except self.model.DoesNotExist: return False obj = confirmation.content_object status_field = get_status_field(obj._meta.app_label, obj._meta.model_name) setattr(obj, status_field, getattr(settings, 'STATUS_ACTIVE', 1)) obj.save() return obj return False
def confirm(self, confirmation_key): # type: (str) -> Union[bool, PreregistrationUser, EmailChangeStatus] if B16_RE.search(confirmation_key): try: confirmation = self.get(confirmation_key=confirmation_key) except self.model.DoesNotExist: return False max_days = self.get_link_validity_in_days() time_elapsed = timezone_now() - confirmation.date_sent if time_elapsed.total_seconds() > max_days * 24 * 3600: return False obj = confirmation.content_object status_field = get_status_field(obj._meta.app_label, obj._meta.model_name) setattr(obj, status_field, getattr(settings, 'STATUS_ACTIVE', 1)) obj.save() return obj return False
def confirm(self, confirmation_key): # type: (str) -> Union[bool, PreregistrationUser, EmailChangeStatus] if B16_RE.search(confirmation_key): try: confirmation = self.get(confirmation_key=confirmation_key) except self.model.DoesNotExist: return False max_days = self.get_link_validity_in_days() time_elapsed = timezone_now() - confirmation.date_sent if time_elapsed.total_seconds() > max_days * 24 * 3600: return False obj = confirmation.content_object status_field = get_status_field(obj._meta.app_label, obj._meta.model_name) setattr(obj, status_field, getattr(settings, 'STATUS_ACTIVE', 1)) obj.save() return obj return False