Skip to content
Snippets Groups Projects
Commit eb6cffc9 authored by Ferenc Schulcz's avatar Ferenc Schulcz
Browse files

Require token seed at registration

parent e84b15a0
No related branches found
No related tags found
No related merge requests found
......@@ -43,6 +43,15 @@ module.exports = function () {
return;
}
if (!('tokenseed' in req.query)) {
res.locals.statuscode = 400;
res.locals.answer = { message: "Also provide token seed." };
next();
return;
}
const tokenSeed = req.query.tokenseed
return db.domainExists(domain).then((exists) => {
if (exists) {
res.locals.statuscode = 400;
......@@ -50,7 +59,7 @@ module.exports = function () {
next();
return;
} else {
const token = md5(domain + randomInt(2 ** 31 - 1) + randomInt(2 ** 31 - 1)).toString('hex');
const token = md5(domain + tokenSeed).toString('hex');
return db.registerDomain(domain, token)
.catch(() => {
res.locals.statuscode = 500;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment