adiXcodr / node-ocr

A Rest API using Express for OCR
2 stars 9 forks source link

Prevent key generation for the same e-mail again #8

Closed paramsiddharth closed 3 years ago

paramsiddharth commented 3 years ago

Prevent key generation for the same e-mail again

Resolves #2: Prevent new key generation for already present emails

The only modification is in the routes/index.js file.

...
if(!jsonData || jsonData.length<1)
  jsonData=[];
if (jsonData.filter(x => x.email === req.props.email).length > 0)
  return res.json({ status: 'Failure', data: 'E-mail already exists.' });
...

This discontinues the key-generation if the e-mail address already exists.