Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const randomstring = require("randomstring")
- exports.forgotPassword = function (req, res){
- var random = Common.encrypt(randomstring.generate({length: 5, charset: 'alphabetic'}));
- User.findUserUpdate({username: req.body.username}, {password: random}, function(err, user) {
- if (!err) {
- if (user === null){
- return res.send(Boom.forbidden("invalid username"));
- }
- else{
- Common.sentMailForgotPassword(user);
- return res.send("password is send to registered email id");
- }
- } else {
- return res.send(Boom.badImplementation(err));
- }
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement