diff --git a/website/common/script/constants.js b/website/common/script/constants.js index 248560f28a..b3510378e0 100644 --- a/website/common/script/constants.js +++ b/website/common/script/constants.js @@ -25,8 +25,6 @@ export const SUPPORTED_SOCIAL_NETWORKS = [ { key: 'apple', name: 'Apple' }, ]; -export const OFFICIAL_PLATFORMS = ['habitica-web', 'habitica-ios', 'habitica-android']; - export const GUILDS_PER_PAGE = 30; // number of guilds to return per page when using pagination export const PARTY_LIMIT_MEMBERS = 29; diff --git a/website/common/script/index.js b/website/common/script/index.js index 3c6b5b0d6c..3045e012ee 100644 --- a/website/common/script/index.js +++ b/website/common/script/index.js @@ -22,7 +22,6 @@ import { TAVERN_ID, MAX_MESSAGE_LENGTH, MAX_GIFT_MESSAGE_LENGTH, - OFFICIAL_PLATFORMS, } from './constants'; import content from './content/index'; import * as count from './count'; @@ -125,7 +124,6 @@ api.constants = { MAX_MESSAGE_LENGTH, MAX_GIFT_MESSAGE_LENGTH, MAX_LEVEL_HARD_CAP, - OFFICIAL_PLATFORMS, }; // TODO Move these under api.constants api.maxLevel = MAX_LEVEL; diff --git a/website/server/controllers/api-v3/user.js b/website/server/controllers/api-v3/user.js index c5e1acbc8e..c26a0802eb 100644 --- a/website/server/controllers/api-v3/user.js +++ b/website/server/controllers/api-v3/user.js @@ -22,8 +22,8 @@ import { } from '../../libs/email'; import * as inboxLib from '../../libs/inbox'; import * as userLib from '../../libs/user'; -import { OFFICIAL_PLATFORMS } from '../../../common/script/constants'; +const OFFICIAL_PLATFORMS = ['habitica-web', 'habitica-ios', 'habitica-android']; const TECH_ASSISTANCE_EMAIL = nconf.get('EMAILS_TECH_ASSISTANCE_EMAIL'); const DELETE_CONFIRMATION = 'DELETE'; diff --git a/website/server/middlewares/auth.js b/website/server/middlewares/auth.js index dfc01ed99e..b69cbb41ac 100644 --- a/website/server/middlewares/auth.js +++ b/website/server/middlewares/auth.js @@ -10,6 +10,7 @@ import gcpStackdriverTracer from '../libs/gcpTraceAgent'; import common from '../../common'; import { getLanguageFromUser } from '../libs/language'; +const OFFICIAL_PLATFORMS = ['habitica-web', 'habitica-ios', 'habitica-android']; const COMMUNITY_MANAGER_EMAIL = nconf.get('EMAILS_COMMUNITY_MANAGER_EMAIL'); const USER_FIELDS_ALWAYS_LOADED = ['_id', 'notifications', 'preferences', 'auth', 'flags', 'permissions']; @@ -91,8 +92,8 @@ export function authWithHeaders (options = {}) { req.session.userId = user._id; stackdriverTraceUserId(user._id); user.auth.timestamps.updated = new Date(); - if (common.constants.OFFICIAL_PLATFORMS.indexOf(client) === -1 && !user.flags.thirdPartyTools) { - User.updateOne(userQuery, { $set: { 'flags.thirdPartyTools': true }}).exec(); + if (OFFICIAL_PLATFORMS.indexOf(client) === -1 && !user.flags.thirdPartyTools) { + User.updateOne(userQuery, { $set: { 'flags.thirdPartyTools': new Date() } }).exec(); } return next(); }) diff --git a/website/server/models/user/schema.js b/website/server/models/user/schema.js index 2af2b88e66..6e462b9e35 100644 --- a/website/server/models/user/schema.js +++ b/website/server/models/user/schema.js @@ -306,7 +306,7 @@ export default new Schema({ cardReceived: { $type: Boolean, default: false }, warnedLowHealth: { $type: Boolean, default: false }, verifiedUsername: { $type: Boolean, default: false }, - thirdPartyTools: { $type: Boolean, default: false }, + thirdPartyTools: { $type: Date }, }, history: {