Allow Meteor Accounts to have multiple users with the same email address

922 views Asked by At

I'm building a Meteor app where I don't care if two people have the same email address because I'm using the username as login key.

I've been searching for a way to setup Meteor Accounts (accounts-password) to make this possible but I couldn't find any resource.

Is it even possible ? Should I roll my own registration mechanism just for that small difference ?

1

There are 1 answers

0
Webritos On

In account-base.js, this index is set

Meteor.users._ensureIndex('emails.address', {unique: 1, sparse: 1});  

This is what set the behaviour. We need to drop that index. Looking at the doc, i see that

Meteor.users._dropIndex({"emails.address": 1});

will do the trick, BUT, I am new i Meteor, so I don't know where to put this and if this is the best approach.

I put it in a server file and it worked fine... but research more