gpt4 book ai didi

node.js - 在 Node js 中使用 secret token 进行电子邮件验证

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

我正在尝试通过从电子邮件中发送的链接中获取 secret token 来验证用户。我能够提取 secret token ,但无法将 active 的值更新为 true。下面是我的代码

router.route('/verify')
.get((req,res)=>{

console.log('request recieved');
const token = req.query.id;

User.updateOne(
{ secretToken: token },
{
$set: { price: true }

},function(err,res){

if(err){
throw err;
}
else{
console.log('one document updated');
}
}
);

});




"email": "surendrap720@gmail.com",
"username": "surendrap720",
"password": "$2a$10$UEKSpPpVWfZ3urclkayW6OcAUvscBrql23WU6fvfbI0Nd1jzo2Bxa",
"type": "tutor",
"secretToken": "5A6fXVh5gEObwUQxgpG4DpJ85COMJveJ",
"active": false,

最佳答案

您根本没有在 updateOne 代码中修改 active

更改此:

$set: { price: true }

对此:

{ active: true }

关于node.js - 在 Node js 中使用 secret token 进行电子邮件验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52524059/

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