提问人:vajk93 提问时间:11/18/2023 更新时间:11/18/2023 访问量:7
STRAPI电子邮件确认缺少令牌(未生成/未接收)
strapi email confirmation missing token(not generate/not receiving)
问:
我做了一个angular/strapi(4.15.00)项目,我可以在其中注册用户。我在strapi后台启用了向新用户发送确认电子邮件的功能,并且该电子邮件应包含令牌。<%= TOKEN %>但未生成令牌。我也发送了重置密码电子邮件,这很好用,我得到了令牌,我可以使用它进行身份验证。 从理论上讲,strapi 会为我生成一个令牌,就像重置密码方法一样。我是strapi的新手。
前端角度方法:
public register(data: IUserData): Observable<any> {
return this.http.post(API_URL + '/api/auth/local/register', data).pipe(
tap({
next: (res: any) => {
console.log(
'Registration successful, confirmation email sent:',
res
);
localStorage.setItem(JWT_FIELD, res.jwt);
console.log(
'timeLockOrStayLoggedIn:' + data.timeLockOrStayLoggedIn
);
},
error: (error) => {
console.log('An error occurred:', error);
},
})
);
}
在高级设置中,我启用了电子邮件确认。
我检查角色 => 个用户和权限=> PUBLIC =>电子邮件和用户权限的所有内容 我检查角色 => 个用户和权限 => AUTHENTICATED => 电子邮件和用户权限上的所有内容
这是我用于电子邮件确认的测试电子邮件模板:(我尝试了一些格式,但没有任何效果)
<p><%= URL %>?confirmation=<%= TOKEN %></p>
<p>http://localhost:4200/login/sign-in?code=<%= TOKEN %></p>
<p>http://localhost:1337/api/auth/email-confirmation?confirmation=<%= TOKEN %></p>
<p>http://localhost:4200/login/sign-in?confirmation=<%= TOKEN %></p>
<p><%= TOKEN %></p>
<p><%= URL%></p>
每个链接在浏览器上显示此消息:
"{"data":null,"error":{"status":400,"name":"ValidationError","message":"confirmation is a required field","details":{"errors":[{"path":["confirmation"],"message":"confirmation is a required field","name":"ValidationError"}]}}}"
有谁知道,如何解决这个问题:D? 谢谢!
答: 暂无答案
评论