Fix bandit and prospector errors

This commit is contained in:
Jens Langhammer 2018-12-10 14:26:10 +01:00
parent 545795ebc6
commit 6bcb5ef8ef
2 changed files with 15 additions and 15 deletions

View File

@ -23,7 +23,7 @@ class AuditEntry(UUIDModel):
ACTION_AUTHORIZE_APPLICATION = 'authorize_application' ACTION_AUTHORIZE_APPLICATION = 'authorize_application'
ACTION_SUSPICIOUS_REQUEST = 'suspicious_request' ACTION_SUSPICIOUS_REQUEST = 'suspicious_request'
ACTION_SIGN_UP = 'sign_up' ACTION_SIGN_UP = 'sign_up'
ACTION_PASSWORD_RESET = 'password_reset' ACTION_PASSWORD_RESET = 'password_reset' # noqa
ACTION_INVITE_CREATED = 'invitation_created' ACTION_INVITE_CREATED = 'invitation_created'
ACTION_INVITE_USED = 'invitation_used' ACTION_INVITE_USED = 'invitation_used'
ACTIONS = ( ACTIONS = (
@ -60,8 +60,8 @@ class AuditEntry(UUIDModel):
entry = AuditEntry.objects.create( entry = AuditEntry.objects.create(
action=action, action=action,
user=request.user, user=request.user,
# User 0.0.0.0 as fallback if IP cannot be determined # User 255.255.255.255 as fallback if IP cannot be determined
request_ip=client_ip or '0.0.0.0', request_ip=client_ip or '255.255.255.255',
_context=dumps(kwargs)) _context=dumps(kwargs))
LOGGER.debug("Logged %s from %s (%s)", action, request.user, client_ip) LOGGER.debug("Logged %s from %s (%s)", action, request.user, client_ip)
return entry return entry

View File

@ -176,7 +176,7 @@ class SignUpView(UserPassesTestMixin, FormView):
"""Create user from data """Create user from data
Args: Args:
data: Dictionary as returned by SignupForm's cleaned_data data: Dictionary as returned by SignUpForm's cleaned_data
request: Optional current request. request: Optional current request.
Returns: Returns:
@ -201,17 +201,17 @@ class SignUpView(UserPassesTestMixin, FormView):
user=new_user, user=new_user,
request=request) request=request)
# try: # try:
# TODO: Create signal for signup # TODO: Create signal for signup
# on_user_sign_up.send( # on_user_sign_up.send(
# sender=None, # sender=None,
# user=new_user, # user=new_user,
# request=request, # request=request,
# password=data.get('password'), # password=data.get('password'),
# needs_confirmation=needs_confirmation) # needs_confirmation=needs_confirmation)
# TODO: Implement Verification, via email or others # TODO: Implement Verification, via email or others
# if needs_confirmation: # if needs_confirmation:
# Create Account Confirmation UUID # Create Account Confirmation UUID
# AccountConfirmation.objects.create(user=new_user) # AccountConfirmation.objects.create(user=new_user)
# except SignalException as exception: # except SignalException as exception:
# LOGGER.warning("Failed to sign up user %s", exception, exc_info=exception) # LOGGER.warning("Failed to sign up user %s", exception, exc_info=exception)
# new_user.delete() # new_user.delete()