MCPcopy Create free account
hub / github.com/CFBD/cfb-api / generateKey

Function generateKey

app/auth/auth.controller.js:7–25  ·  view source on GitHub ↗
(req, res)

Source from the content-addressed store, hash-verified

5 const emailPattern = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/;
6
7 const generateKey = async (req, res) => {
8 try {
9 if (!req.body && !req.body.email) {
10 res.status(400).send({
11 error: 'An email address is required'
12 });
13 } else if (!emailPattern.test(req.body.email)) {
14 res.status(400).send({
15 error: 'A valid email address is required'
16 });
17 } else {
18 await service.generateKey(req.body.email);
19 res.sendStatus(200);
20 }
21 } catch (err) {
22 Sentry.captureException(err);
23 res.status(500).send('Something went wrong');
24 }
25 };
26
27 const graphQLAuth = async (req, res) => {
28 try {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected