Accounts and login.

This commit is contained in:
Mike Cao 2020-07-23 19:56:55 -07:00
parent f3f0ad15f2
commit 49a55b40b4
22 changed files with 347 additions and 172 deletions

View file

@ -1,12 +1,12 @@
import { getWebsite, getSession, createSession } from 'lib/db';
import { getCountry, getDevice, getIpAddress } from 'lib/utils';
import { uuid, isValidHash, verifyToken } from 'lib/crypto';
import { uuid, isValidId, verifyToken } from 'lib/crypto';
export default async req => {
const { payload } = req.body;
const { website: website_uuid, hostname, screen, language, session } = payload;
if (!isValidHash(website_uuid)) {
if (!isValidId(website_uuid)) {
throw new Error(`Invalid website: ${website_uuid}`);
}