Use email hash to generate id
This commit is contained in:
parent
cc68eca2f8
commit
19871ee647
@ -1,5 +1,6 @@
|
|||||||
import config from 'lib/env';
|
import { createHash } from 'crypto';
|
||||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||||
|
import config from 'lib/env';
|
||||||
import type { User } from 'types';
|
import type { User } from 'types';
|
||||||
import {
|
import {
|
||||||
createResponseForm,
|
createResponseForm,
|
||||||
@ -16,8 +17,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||||||
if (!email.endsWith('@example.com')) {
|
if (!email.endsWith('@example.com')) {
|
||||||
res.status(403).send(`${email} denied access`);
|
res.status(403).send(`${email} denied access`);
|
||||||
}
|
}
|
||||||
|
const id = createHash('sha256').update(email).digest('hex');
|
||||||
const id = email.replace('@example.com', '');
|
|
||||||
|
|
||||||
const user: User = {
|
const user: User = {
|
||||||
id,
|
id,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user