def send_new_user_email(request): uuid = request.data.get("portunus_uuid") if not uuid: return make_response(False) try: user = User.objects.get(portunus_uuid=uuid) except User.DoesNotExist: # Send back success even if the account DNE to avoid leaking uuids. return make_response() PortunusMailer.send_account_creation_notice(user) return make_response()
def create(self, validated_data): user = User(**validated_data) user.set_unusable_password() user.save() PortunusMailer.send_account_creation_notice(user) return user