Browse Source

Fix protocol in Email.

pull/6/head
Tian Yunhao 6 years ago
parent
commit
793597085b
  1. 6
      modules/api.js

6
modules/api.js

@ -42,7 +42,8 @@ app.post('/api/forget', async (req, res) => {
expiresIn: '12h' expiresIn: '12h'
}); });
const vurl = req.protocol + '://' + req.get('host') + syzoj.utils.makeUrl(['api', 'forget_confirm'], { token: token }); const currentProto = req.get("X-Forwarded-Proto") || req.protocol;
const vurl = currentProto + '://' + req.get('host') + syzoj.utils.makeUrl(['api', 'forget_confirm'], { token: token });
try { try {
await Email.send(user.email, await Email.send(user.email,
`${user.username}${syzoj.config.title} 密码重置邮件`, `${user.username}${syzoj.config.title} 密码重置邮件`,
@ -92,7 +93,8 @@ app.post('/api/sign_up', async (req, res) => {
expiresIn: '2d' expiresIn: '2d'
}); });
const vurl = req.protocol + '://' + req.get('host') + syzoj.utils.makeUrl(['api', 'sign_up_confirm'], { token: token }); const currentProto = req.get("X-Forwarded-Proto") || req.protocol;
const vurl = currentProto + '://' + req.get('host') + syzoj.utils.makeUrl(['api', 'sign_up_confirm'], { token: token });
try { try {
await Email.send(req.body.email, await Email.send(req.body.email,
`${req.body.username}${syzoj.config.title} 注册验证邮件`, `${req.body.username}${syzoj.config.title} 注册验证邮件`,

Loading…
Cancel
Save