mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
fix(3p): update timing 1/day at most
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import moment from 'moment';
|
||||||
import nconf from 'nconf';
|
import nconf from 'nconf';
|
||||||
import url from 'url';
|
import url from 'url';
|
||||||
import {
|
import {
|
||||||
@@ -92,7 +93,9 @@ export function authWithHeaders (options = {}) {
|
|||||||
req.session.userId = user._id;
|
req.session.userId = user._id;
|
||||||
stackdriverTraceUserId(user._id);
|
stackdriverTraceUserId(user._id);
|
||||||
user.auth.timestamps.updated = new Date();
|
user.auth.timestamps.updated = new Date();
|
||||||
if (OFFICIAL_PLATFORMS.indexOf(client) === -1 && !user.flags.thirdPartyTools) {
|
if (OFFICIAL_PLATFORMS.indexOf(client) === -1
|
||||||
|
&& (!user.flags.thirdPartyTools || moment().diff(user.flags.thirdPartyTools, 'days') > 0)
|
||||||
|
) {
|
||||||
User.updateOne(userQuery, { $set: { 'flags.thirdPartyTools': new Date() } }).exec();
|
User.updateOne(userQuery, { $set: { 'flags.thirdPartyTools': new Date() } }).exec();
|
||||||
}
|
}
|
||||||
return next();
|
return next();
|
||||||
|
|||||||
Reference in New Issue
Block a user