mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
Hydro.error; csrf_token validation
This commit is contained in:
1 parent
b22082beba
commit
e15c05d36b
9 files changed
+134
-267
No files matched your search
+10
-7
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user