updated frontend adress in generatePasswordResetLi

This commit is contained in:
2020-10-08 14:41:25 +02:00
parent 34c14e03bf
commit 01a0788003
2 changed files with 27 additions and 21 deletions

View File

@@ -8,29 +8,35 @@ var router = express.Router();
// SEARCH RESTAURANTS BY NAME OR CITY // SEARCH RESTAURANTS BY NAME OR CITY
router.get("/", async (req, res) => { router.get("/", async (req, res) => {
if (req.query.string.length > 0) { try {
const query = sanitizer.sanitize.keepUnicode(decodeURI(req.query.string)); if (req.query.string.length > 0) {
const regex = new RegExp(query, "i"); const query = sanitizer.sanitize.keepUnicode(decodeURI(req.query.string));
const regex = new RegExp(query, "i");
Restaurant.find( Restaurant.find(
{ {
$and: [ $and: [
{ $or: [{ city: { $regex: regex } }, { name: { $regex: regex } }] }, { $or: [{ city: { $regex: regex } }, { name: { $regex: regex } }] },
{ $or: [{ hidden: false }, { hidden: { $exists: false } }] }, { $or: [{ hidden: false }, { hidden: { $exists: false } }] },
{ subscriptionActive: true }, { subscriptionActive: true },
], ],
}, },
"_id name city imgUrl workingHours description tags location links", "_id name city imgUrl workingHours description tags location links"
(err, results) => { )
if (err) { .then((response) => {
res.send(response);
})
.catch((err) => {
console.log(err); console.log(err);
res.sendStatus(500); res.sendStatus(500);
} else { });
res.send(results); } else {
} res.send({
} results: [],
); });
} else { }
} catch (error) {
console.log(error);
res.send({ res.send({
results: [], results: [],
}); });

View File

@@ -74,7 +74,7 @@ function generatePasswordResetToken(email) {
function generatePasswordResetLink(email) { function generatePasswordResetLink(email) {
const token = generatePasswordResetToken(email); const token = generatePasswordResetToken(email);
const link = `localhost:3000/resetpassword?token=${token}`; const link = `https://www.menui.pl/resetpassword?token=${token}`;
return link; return link;
} }