Advertisement
Guest User

Untitled

a guest
Feb 26th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. var express = require('express'),
  2. router = express.Router(),
  3. User = require('../models/user'),
  4. path = require("path"),
  5. Passport = require('../middlewares/passport.js');
  6.  
  7. router.get('/changepass',function(req, res){
  8. var token = req.query.token;
  9. User.checkPassToken(token, function(response){
  10. if(response){
  11. res.render('changepass')
  12. }
  13. else{
  14. res.send('<h2>Wrong Token</h2>')
  15. }
  16. })
  17. });
  18.  
  19. router.post('/changepass', function(req, res){
  20. var token = req.query.token;
  21. var pass = req.body.newpass;
  22. User.changePassword(token, pass, function(response){
  23. if(response){
  24. console.log('Password changed success');
  25. res.send('<h2>Ваш пароль успешно изменен</h2>');
  26. }
  27. else{
  28. console.log("Wrong token");
  29. res.send('<h2>Wrong Token</h2>');
  30. }
  31. })
  32. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement