How to make username optional on Meteor Accounts sign-in form

Hi,

I’m using the Accounts package and want to allow my users to login with either a user name or an email. So I want the sign up form to offer the specification of both.

As per the docs this works all fine.

Except, I want the username to be optional. But the standard password form in sign-up mode makes it mandatory. I’ve tried setting the required property on AccountsTemplates.addFields() for the username to false but Meteor then errors with that saying it’s gotta be true. And the optional property is already set to true.

I’ve spent a bit too much time trying to figure out what and were to set something to solve this and I’m guessing there’s an obvious, simple solution that some-one out there knows.

Thanks

1 Like