Improve logging
This commit is contained in:
parent
a7051f80ac
commit
247e221ac6
|
@ -530,9 +530,16 @@ class MyPasswordChangeSerializer(PasswordChangeSerializer):
|
|||
class MyPasswordResetSerializer(PasswordResetSerializer):
|
||||
def validate_email(self, email):
|
||||
if not User.objects.filter(email__iexact=email).exists():
|
||||
logging.info('Email not found: ' + email)
|
||||
raise ValidationError('Not found.')
|
||||
return super().validate_email(email)
|
||||
|
||||
def save(self):
|
||||
email = self.data['email']
|
||||
member = User.objects.get(email__iexact=email).member
|
||||
logging.info('Password reset requested for: {} - {} {} ({})'.format(email, member.first_name, member.last_name, member.id))
|
||||
super().save()
|
||||
|
||||
class MyPasswordResetConfirmSerializer(PasswordResetConfirmSerializer):
|
||||
def save(self):
|
||||
data = dict(
|
||||
|
@ -559,6 +566,9 @@ class MyPasswordResetConfirmSerializer(PasswordResetConfirmSerializer):
|
|||
logger.info(msg)
|
||||
raise ValidationError(dict(non_field_errors=msg))
|
||||
|
||||
member = self.user.member
|
||||
logging.info('Password reset completed for: {} {} ({})'.format(member.first_name, member.last_name, member.id))
|
||||
|
||||
super().save()
|
||||
|
||||
|
||||
|
|
|
@ -84,6 +84,7 @@ class SearchViewSet(Base, Retrieve):
|
|||
result_objects = [queryset.get(id=x) for x in result_ids]
|
||||
|
||||
queryset = result_objects
|
||||
logging.info('Search for: {}, results: {}'.format(search, len(queryset)))
|
||||
elif self.action == 'create':
|
||||
utils.gen_search_strings() # update cache
|
||||
queryset = queryset.order_by('-vetted_date')
|
||||
|
|
Loading…
Reference in New Issue
Block a user