Hydro.error; csrf_token validation

This commit is contained in:
undefined committed 2020-06-30 22:21:07 +08:00
1 parent b22082beba
commit e15c05d36b
9 files changed
+134 -267

No files matched your search

+10 -7
View File
@@ -53,14 +53,17 @@ async function get(tokenId, tokenType) {
*/
async function update(tokenId, tokenType, expireSeconds, data) {
const now = new Date();
const res = await coll.findOneAndUpdate({ _id: tokenId, tokenType }, {
$set: {
...data,
updateAt: now,
expireAt: new Date(now.getTime() + expireSeconds * 1000),
tokenType,
const res = await coll.updateOne(
{ _id: tokenId, tokenType },
{
$set: {
...data,
updateAt: now,
expireAt: new Date(now.getTime() + expireSeconds * 1000),
tokenType,
},
},
});
);
return res.value;
}