Reputation: 21
I am trying to do the user registration process in meteor . I looked at meteor accounts-password package which is very good and handle pretty much all the required logic. For my app ,I am struggling over the following two points ----
1 . Accounts-password api named Accounts.createUser takes a limited parameters like -- username , email , password for registering the user . I am requiring other fields like mobile_number , first_name, last_name, address for completing the user registration by creatUser . The mobile number will be used to send an OTP to verify the user's mobile . For email verification , meteor does it very easily . How can this multiple parameters based create user be executed using the accounts-password api's.
2 . Accounts-password api named Accounts.loginWithPassword only takes email , username and password to login . In my app , user will enter either email or mobile_number as one input and password as second input , and based on this , i need to verify the user and log him in the app . How can the mobile number based loggingIn be included ?
Upvotes: 0
Views: 611
Reputation: 1091
I've had a similar use case where I had to build a system for users with only mobile numbers and no email IDs.
Use the profile field to store additional information. When an user is created, generate the OTP and send it to the mobile number through your SMS gateway. Handle the OTP confirmation through a separate form. (Make sure the OTP is not published to the user).
Store the mobile number as the user name, this way when they user keys in his mobile/email, Meteor.loginWithPassword will check both username/email.
Hope the above helps.
Upvotes: 0