From 6bcb5ef8efe33ac0bbcd66b921b4934ac7095bc7 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 10 Dec 2018 14:26:10 +0100 Subject: [PATCH] Fix bandit and prospector errors --- passbook/audit/models.py | 6 +++--- passbook/core/views/authentication.py | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/passbook/audit/models.py b/passbook/audit/models.py index 84971fc30..18521b526 100644 --- a/passbook/audit/models.py +++ b/passbook/audit/models.py @@ -23,7 +23,7 @@ class AuditEntry(UUIDModel): ACTION_AUTHORIZE_APPLICATION = 'authorize_application' ACTION_SUSPICIOUS_REQUEST = 'suspicious_request' ACTION_SIGN_UP = 'sign_up' - ACTION_PASSWORD_RESET = 'password_reset' + ACTION_PASSWORD_RESET = 'password_reset' # noqa ACTION_INVITE_CREATED = 'invitation_created' ACTION_INVITE_USED = 'invitation_used' ACTIONS = ( @@ -60,8 +60,8 @@ class AuditEntry(UUIDModel): entry = AuditEntry.objects.create( action=action, user=request.user, - # User 0.0.0.0 as fallback if IP cannot be determined - request_ip=client_ip or '0.0.0.0', + # User 255.255.255.255 as fallback if IP cannot be determined + request_ip=client_ip or '255.255.255.255', _context=dumps(kwargs)) LOGGER.debug("Logged %s from %s (%s)", action, request.user, client_ip) return entry diff --git a/passbook/core/views/authentication.py b/passbook/core/views/authentication.py index c14f533da..a7883077f 100644 --- a/passbook/core/views/authentication.py +++ b/passbook/core/views/authentication.py @@ -176,7 +176,7 @@ class SignUpView(UserPassesTestMixin, FormView): """Create user from data Args: - data: Dictionary as returned by SignupForm's cleaned_data + data: Dictionary as returned by SignUpForm's cleaned_data request: Optional current request. Returns: @@ -201,17 +201,17 @@ class SignUpView(UserPassesTestMixin, FormView): user=new_user, request=request) # try: - # TODO: Create signal for signup - # on_user_sign_up.send( - # sender=None, - # user=new_user, - # request=request, - # password=data.get('password'), - # needs_confirmation=needs_confirmation) - # TODO: Implement Verification, via email or others - # if needs_confirmation: - # Create Account Confirmation UUID - # AccountConfirmation.objects.create(user=new_user) + # TODO: Create signal for signup + # on_user_sign_up.send( + # sender=None, + # user=new_user, + # request=request, + # password=data.get('password'), + # needs_confirmation=needs_confirmation) + # TODO: Implement Verification, via email or others + # if needs_confirmation: + # Create Account Confirmation UUID + # AccountConfirmation.objects.create(user=new_user) # except SignalException as exception: # LOGGER.warning("Failed to sign up user %s", exception, exc_info=exception) # new_user.delete()