fix: username / email inconsistency when creating new users

Fixed UserExistsError error message
This commit is contained in:
James Mikrut
2023-05-25 20:47:05 -04:00
committed by GitHub
3 changed files with 17 additions and 3 deletions

View File

@@ -19,6 +19,9 @@ export default function initCollectionsLocal(ctx: Payload): void {
if (collection.auth && !collection.auth.disableLocalStrategy) {
schema.plugin(passportLocalMongoose, {
usernameField: 'email',
errorMessages: {
UserExistsError: 'A user with the given email is already registered',
},
});