Commit 9576ae90 authored by William Colmenares's avatar William Colmenares

Same messages in creation/deletion preventing scape chars errors in password

parent 9711dc1e
......@@ -615,11 +615,13 @@ class SeedRetrieveCreate(APIView):
def post(self, request):
username =['username']
password =['password']
password =[r'password']
realm =['realm']
except KeyError:
return Response('You need to specify username, password, and realm values', 400)
# authenticate the user against ldap
user = authenticate(username=username, password=password)
if user is not None:
admin_seed = config('ADMIN_SEED')
......@@ -636,7 +638,7 @@ class SeedRetrieveCreate(APIView):
for elem in response_data:
if elem['name'] == username and elem['realm'] == realm:
return Response('Your {} seed is {}'.format(realm, elem['seed']), 200)
return Response(elem, 200)
# If doesn't find a match then check if the realm is allowed and create the user
allowed_realms = config('ALLOWED_REALMS', cast=Csv())
if realm not in allowed_realms:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment