gpt4 book ai didi

javascript - 环回验证邮件 http ://https://example. api.com:port

转载 作者:太空宇宙 更新时间:2023-11-04 01:54:35 25 4
gpt4 key购买 nike

我目前正在尝试运行

member.verify()

在我的环回应用程序中,电子邮件发送得非常好,除了电子邮件中的网址格式如下:-

http://https://example.api.com:port

members.js 包含以下代码,用于在创建新成员时发送电子邮件:-

Member.afterRemote('create', function(context, member, next) {
console.log('Sending Verification Email');

var options = {
type: 'email',
to: member.email,
from: 'noreply@example.com',
subject: 'Thanks for registering.',
template: path.resolve(__dirname, '../../server/views/verify.ejs'),
redirect: 'https://' + config.host + '/login?verified=true',
user: member
};

member.verify(options, function(err) {
console.log('Verification Email sent:', member, options, err);
if (err){
next(err);
}else{
next();
}
});

});

verify.ejs 仅包含:-

This is the html version of your email.
<strong><%= text %></strong>

还有其他人遇到过这个问题或者知道如何解决吗?

还有谁知道如何删除 URL 末尾的端口号吗?

如果您需要任何其他信息,请告诉我。

编辑:-

我在API的node_modules/loopback/common/models/user.js中找到了以下代码

var displayPort = (
(verifyOptions.protocol === 'http' && verifyOptions.port == '80') ||
(verifyOptions.protocol === 'https' && verifyOptions.port == '443')
) ? '' : ':' + verifyOptions.port;

var urlPath = joinUrlPath(
verifyOptions.restApiRoot,
userModel.http.path,
userModel.sharedClass.findMethodByName('confirm').http.path
);

verifyOptions.verifyHref = verifyOptions.verifyHref ||
verifyOptions.protocol +
'://' +
verifyOptions.host +
displayPort +
urlPath +
'?' + qs.stringify({
uid: '' + verifyOptions.user[pkName],
redirect: verifyOptions.redirect,
});

有什么方法可以覆盖这些信息吗?

最佳答案

好的,我已经使用以下方法解决了这个问题:-

var options = {
type: 'email',
to: member.email,
from: 'noreply@clientplan.com',
subject: 'Thanks for registering.',
template: path.resolve(__dirname, '../../server/views/verify.ejs'),
redirect: 'https://client-plan-app.herokuapp.com/admin',
user: member,
protocol: 'https',
port : '443'
};

我添加了以下几行来解决此问题:-

protocol: 'https',
port : '443'

关于javascript - 环回验证邮件 http ://https://example. api.com:port,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48461691/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com