Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

change const

Brian Cao075d77abac63
diff --git a/lib/auth.js b/lib/auth.js
index 1011cda8c..09d84cccf 100644
--- a/lib/auth.js
+++ b/lib/auth.js
@@ -1,7 +1,7 @@
import { parseSecureToken, parseToken } from 'next-basics';
import { getUser, getWebsite } from 'queries';
import debug from 'debug';
-import { SHARE_TOKEN_HEADER, TYPE_ACCOUNT, TYPE_WEBSITE } from 'lib/constants';
+import { SHARE_TOKEN_HEADER, TYPE_USER, TYPE_WEBSITE } from 'lib/constants';
import { secret } from 'lib/crypto';
const log = debug('umami:auth');
@@ -58,7 +58,7 @@ export async function allowQuery(req, type) {
const website = await getWebsite({ id });
return website && website.userId === userId;
- } else if (type === TYPE_ACCOUNT) {
+ } else if (type === TYPE_USER) {
const user = await getUser({ id });
return user && user.id === id;
diff --git a/lib/constants.js b/lib/constants.js
index 7a791a503..0e4eabec9 100644
--- a/lib/constants.js
+++ b/lib/constants.js
@@ -22,7 +22,7 @@ export const REALTIME_RANGE = 30;
export const REALTIME_INTERVAL = 3000;
export const TYPE_WEBSITE = 'website';
-export const TYPE_ACCOUNT = 'user';
+export const TYPE_USER = 'user';
export const THEME_COLORS = {
light: {
diff --git a/pages/api/users/[id]/password.js b/pages/api/users/[id]/password.js
index fcb39df88..6cad82edf 100644
--- a/pages/api/users/[id]/password.js
+++ b/pages/api/users/[id]/password.js
@@ -9,7 +9,7 @@ import {
hashPassword,
} from 'next-basics';
import { allowQuery } from 'lib/auth';
-import { TYPE_ACCOUNT } from 'lib/constants';
+import { TYPE_USER } from 'lib/constants';
export default async (req, res) => {
await useAuth(req, res);
@@ -17,7 +17,7 @@ export default async (req, res) => {
const { current_password, new_password } = req.body;
const { id } = req.query;
- if (!(await allowQuery(req, TYPE_ACCOUNT))) {
+ if (!(await allowQuery(req, TYPE_USER))) {
return unauthorized(res);
}