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)) {
|
||||
logger.debug(`registerServices.createRegKey: Key from valid: ${domain}`);
|
||||
const key = generateCode()
|
||||
db.addRegReq(key, domain)
|
||||
const message = await auth.generateConfirmationEmail(body.email, key);
|
||||
if (!message) {
|
||||
const err = new Error("Message Generation Error");
|
||||
@ -35,8 +36,9 @@ async function createRegKey(body) {
|
||||
|
||||
async function regUser(req) {
|
||||
// Add input validation
|
||||
logger.trace(`Read UUID: ${req.uuid}`);
|
||||
const res = await auth.checkRequest(req.uuid);
|
||||
const regCode = req.uuid.toLocaleUpperCase();
|
||||
logger.trace(`Read UUID: ${regCode}`);
|
||||
const res = await auth.checkRequest(regCode);
|
||||
logger.debug(res, "registrationServices");
|
||||
if (res.result) {
|
||||
const uuid = await auth.generateKey();
|
||||
|
Loading…
Reference in New Issue
Block a user