Passport: Allow sign up with name and email address? (Local Strategy)

后端 未结 6 2296
孤街浪徒
孤街浪徒 2020-12-31 01:15

Is there any way to allow a user to register on the local strategy with his password, email and name?
Every example I could find online only use name/password or email/p

6条回答
  •  天命终不由人
    2020-12-31 01:50

    UserModel.find({email: req.body.email}, function(err, user){                                               
        if(err){                                                                  
           res.redirect('/your sign up page');                                                                          
        } else {                                                                  
          if(user.length > 0){                                                    
           res.redirect('/again your sign up page');                                                                      
          } else{                                                               
            //YOUR REGISTRATION CODES HERE                                                                     
           }                                                                          
        }                                                                        
    })
    

提交回复
热议问题