Same messages in creation/deletion preventing scape chars errors in password
This commit is contained in:
		
					parent
					
						
							
								9711dc1ecc
							
						
					
				
			
			
				commit
				
					
						9576ae9064
					
				
			
		
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -615,11 +615,13 @@ class SeedRetrieveCreate(APIView):
 | 
				
			||||||
    def post(self, request):
 | 
					    def post(self, request):
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            username = request.data['username']
 | 
					            username = request.data['username']
 | 
				
			||||||
            password = request.data['password']
 | 
					            password = request.data[r'password']
 | 
				
			||||||
            realm = request.data['realm']
 | 
					            realm = request.data['realm']
 | 
				
			||||||
 | 
					            print(password)
 | 
				
			||||||
        except KeyError:
 | 
					        except KeyError:
 | 
				
			||||||
            return Response('You need to specify username, password, and realm values', 400)
 | 
					            return Response('You need to specify username, password, and realm values', 400)
 | 
				
			||||||
        # authenticate the user against ldap
 | 
					        # authenticate the user against ldap
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        user = authenticate(username=username, password=password)
 | 
					        user = authenticate(username=username, password=password)
 | 
				
			||||||
        if user is not None:
 | 
					        if user is not None:
 | 
				
			||||||
            admin_seed = config('ADMIN_SEED')
 | 
					            admin_seed = config('ADMIN_SEED')
 | 
				
			||||||
| 
						 | 
					@ -636,7 +638,7 @@ class SeedRetrieveCreate(APIView):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            for elem in response_data:
 | 
					            for elem in response_data:
 | 
				
			||||||
                if elem['name'] == username and elem['realm'] == realm:
 | 
					                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
 | 
					            # If doesn't find a match then check if the realm is allowed and create the user
 | 
				
			||||||
            allowed_realms = config('ALLOWED_REALMS', cast=Csv())
 | 
					            allowed_realms = config('ALLOWED_REALMS', cast=Csv())
 | 
				
			||||||
            if realm not in allowed_realms:
 | 
					            if realm not in allowed_realms:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue