Replace registration stream with code based
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
parent
91e2657d66
commit
236d85648d
@ -16,6 +16,7 @@ async function createRegKey(body) {
|
|||||||
if (validDomains.includes(domain)) {
|
if (validDomains.includes(domain)) {
|
||||||
logger.debug(`registerServices.createRegKey: Key from valid: ${domain}`);
|
logger.debug(`registerServices.createRegKey: Key from valid: ${domain}`);
|
||||||
const key = generateCode()
|
const key = generateCode()
|
||||||
|
db.addRegReq(key, domain)
|
||||||
const message = await auth.generateConfirmationEmail(body.email, key);
|
const message = await auth.generateConfirmationEmail(body.email, key);
|
||||||
if (!message) {
|
if (!message) {
|
||||||
const err = new Error("Message Generation Error");
|
const err = new Error("Message Generation Error");
|
||||||
@ -35,8 +36,9 @@ async function createRegKey(body) {
|
|||||||
|
|
||||||
async function regUser(req) {
|
async function regUser(req) {
|
||||||
// Add input validation
|
// Add input validation
|
||||||
logger.trace(`Read UUID: ${req.uuid}`);
|
const regCode = req.uuid.toLocaleUpperCase();
|
||||||
const res = await auth.checkRequest(req.uuid);
|
logger.trace(`Read UUID: ${regCode}`);
|
||||||
|
const res = await auth.checkRequest(regCode);
|
||||||
logger.debug(res, "registrationServices");
|
logger.debug(res, "registrationServices");
|
||||||
if (res.result) {
|
if (res.result) {
|
||||||
const uuid = await auth.generateKey();
|
const uuid = await auth.generateKey();
|
||||||
|
Loading…
Reference in New Issue
Block a user