Commit 31acd6d0 authored by Wolfgang Knopki's avatar Wolfgang Knopki
Browse files

token reset passwd

parent f53cb8e1
Pipeline #359 passed with stage
in 8 seconds
module.exports = {
development: {
app: {
hostname: 'm4lab.hft-stuttgart.de/account/',
hostname: 'm4lab.hft-stuttgart.de/account',
name: 'User Account Management',
port: process.env.PORT || 9989
},
......
......@@ -364,11 +364,12 @@ module.exports = function (app, config, passport) {
});
app.post('/reset/:token', function(req, res) {
var newPwd = req.body.inputNewPwd
methods.checkUserToken(req.params.token, function(err, user){
if (user) {
// update password
bcrypt.genSalt(saltRounds, function(err, salt) {
bcrypt.hash(req.params.inputNewPwd, salt, function(err, hash) {
bcrypt.hash(newPwd, salt, function(err, hash) {
methods.updatePassword(hash, user.email, function(err){
if (err) {
req.flash('error', "Database error: Password cannot be modified.")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment