You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is working fine for login but at the time of signup using the above config it is throwing error
BadRequestError: Field mobile is not set when i pass the {email : '[email protected]'} in user. register function.
In my application flow, user have only 2 fields in signup form. one for email/mobile and another for password. if user enter a email then it goes to the email field of userSchema otherwise it goes to mobile field.
The text was updated successfully, but these errors were encountered:
schema.statics.register=function(user,password,cb){// Create an instance of this in case user isn't already an instanceif(!(userinstanceofthis)){user=newthis(user);}// check each username query fieldvarusernameFieldFound=false,usernameField;for(vari=0;i<options.usernameQueryFields.length&&!usernameFieldFound;i++){if(user.get(options.usernameQueryFields[i])){usernameField=options.usernameQueryFields[i];usernameFieldFound=true;}}if(!usernameFieldFound){//@todo need to refactor thisreturncb(newBadRequestError(util.format(options.missingUsernameError,options.usernameField)));}/*if (!user.get(options.usernameField)) { return cb(new BadRequestError(util.format(options.missingUsernameError, options.usernameField))); }*/varself=this;self.findByUsername(user.get(usernameField),function(err,existingUser){if(err){returncb(err);}if(existingUser){returncb(newBadRequestError(util.format(options.userExistsError,options.usernameField,user.get(options.usernameField))));}user.setPassword(password,function(err,user){if(err){returncb(err);}user.save(function(err){if(err){returncb(err);}cb(null,user);});});});};
i have added the new field for usernameQueryFields
This is working fine for login but at the time of signup using the above config it is throwing error
BadRequestError: Field mobile is not set when i pass the {email : '[email protected]'} in user. register function.
In my application flow, user have only 2 fields in signup form. one for email/mobile and another for password. if user enter a email then it goes to the email field of userSchema otherwise it goes to mobile field.
The text was updated successfully, but these errors were encountered: