When creating superuser, currently there's no guard to protect against already created superuser.
If you seed superuser more then one times, it breaks login for that particular user as the request throws InternalServerError on login
Modifications
In the same style of other guards within UsersController I've added query to repository to get entity by name for the incoming user payload. If the entity exists we return validation error.
Verifying this change
[x] Make sure that the change passes the ./gradlew build checks.
Fixes #563 and #537
Motivation
When creating superuser, currently there's no guard to protect against already created superuser. If you seed superuser more then one times, it breaks login for that particular user as the request throws
InternalServerError
on loginModifications
In the same style of other guards within
UsersController
I've added query to repository to get entity by name for the incoming user payload. If the entity exists we return validation error.Verifying this change
./gradlew build
checks.