Fixed IP-Hashing and Alt Detection behind Reverse Proxies
This commit is contained in:
parent
46a7e9e067
commit
8b6aa69c51
7 changed files with 42 additions and 10 deletions
|
|
@ -34,6 +34,9 @@ module.exports.post = async function(req, res){
|
|||
//Find user from input
|
||||
const userDB = await userModel.findOne({user});
|
||||
|
||||
//If we're proxied use passthrough IP
|
||||
const ip = config.proxied ? req.headers['x-forwarded-for'] : req.ip;
|
||||
|
||||
//If there is no user
|
||||
if(userDB == null){
|
||||
//Scream
|
||||
|
|
@ -41,7 +44,7 @@ module.exports.post = async function(req, res){
|
|||
}
|
||||
|
||||
//Generate the password reset link
|
||||
const requestDB = await passwordResetModel.create({user: userDB._id, ipHash: req.ip});
|
||||
const requestDB = await passwordResetModel.create({user: userDB._id, ipHash: ip});
|
||||
|
||||
//send URL
|
||||
res.status(200);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue