I’ve got a database project I’m using for migrations, have setup the AppHost properly to use my CustomAuthRepository (using an existing user store), but when seeding some initial users using CustomAuthRepository (which has no override for CreateUserAuth, it is using the BaseAuthRepository by default), it does not work because of issues with the UserName:
If I don’t populate a username, it’s a failure at the DB level (because UserName is required)
When I populate a UserName (which are emails), it fails with:
To create a User with an Email UserName use the Email field and leave the UserName unspecified. Users will still be able to login using their Email which will check against the Email field.
It seems this could be an incompatibility with my legacy users schema, as it is most likely the one that requires a UserName (it duplicates the UserName as the Email field). Is there no path forward other than making it nullable?
There’s no additional Username validation in the Auth Repo, but the behavior still remains if the UserName contains a @ then it will match on the Email field, otherwise it will match on the UserName field when validating UserName/Password.