From dca5d4b7574880fd5dcc028cf91b76a34d01ac68 Mon Sep 17 00:00:00 2001 From: Khue Nguyen Date: Sun, 4 Feb 2018 17:22:20 -0800 Subject: [PATCH] added protocol check --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 230c04f7..8a2f02f6 100644 --- a/index.js +++ b/index.js @@ -263,7 +263,8 @@ module.exports = (nextApp, { } const token = uuid() - const url = (serverUrl || `http://${req.headers.host}`) + `${pathPrefix}/email/signin/${token}` + const http = req.secure ? 'https' : 'http' + const url = (serverUrl || `${http}://${req.headers.host}`) + `${pathPrefix}/email/signin/${token}` // Create verification token save it to database functions.find({ email: email })