diff --git a/modules/routes/routeSecurityLocal.py b/modules/routes/routeSecurityLocal.py index 608528d8..6d2ffd73 100644 --- a/modules/routes/routeSecurityLocal.py +++ b/modules/routes/routeSecurityLocal.py @@ -121,12 +121,20 @@ async def register_user(userData: User): # Get gateway interface appInterface = getInterface() - # Create user + # Get default mandate ID + defaultMandateId = appInterface.getInitialId("mandates") + if not defaultMandateId: + raise HTTPException( + status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail="No default mandate found" + ) + + # Create user with default mandate user = appInterface.createUser( username=userData.username, password=userData.password, email=userData.email, - mandateId=userData.mandateId, + mandateId=defaultMandateId, # Use default mandate instead of userData.mandateId authenticationAuthority=AuthAuthority.LOCAL )