V
V
Vyacheslav2017-08-26 12:31:16
Node.js
Vyacheslav, 2017-08-26 12:31:16

What if you need to change the module received through npm?

I had a problem with the passport module in conjunction with connect-pg-simple.
The problem is known.
Although the question is closed, the solution did not fit me. I made a small change (a couple of lines) in passport: it allows for failureRedirect to specify a function instead of a path, something like:

exports.login = passport.authenticate('local', {
  failureRedirect:   function(req,res){
      req.session.save(() => {
          res.redirect('/login');
      })},
  failureFlash: true,
  successRedirect: '/',
  successFlash: false
});

The question was decided, now it's different: how to live with this decision?
The likelihood that this will be added to passport in one form or another is not great. Or I'm wrong ?
Patch passport manually every time, so-so fun.
To remove the patched passport to yourself is nonsense (it pulls a bunch of everything with it).
Can anyone suggest something better?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2017-08-26
@pvv38

You can also fork in package.json, as in the example: https://docs.npmjs.com/files/package.json#github-urls

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question