1
0
forked from apxtri/apxtri

bug ls in sendmail + log in pagans

This commit is contained in:
philc 2024-02-20 07:27:45 +01:00
parent 4f1b99d494
commit ff93e84628
3 changed files with 15 additions and 12 deletions

View File

@ -478,6 +478,7 @@ Odmdb.cud = (objectPathname, crud, itm, role, runindex = true) => {
data: { missingkey: getschema.data.schema.apxid },
};
}
if (log) console.log(currentmod,"Schema pass:",req.session.header);
fs.ensureDirSync(`${objectPathname}/itm/`);
fs.ensureDirSync(`${objectPathname}/idx/`);
const existid = fs.existsSync(

View File

@ -36,7 +36,7 @@ Pagans.logout = (alias, tribe, xdays, xhash) => {
//max filename in ext4: 255 characters
tmpfs += `_${xhash.substring(150, 150 + tmpfs.length - 249)}.json`;
fs.remove(tmpfs);
console.log('logout token',tmpfs)
if (log) console.log(currentmod,'logout token',tmpfs)
return { status: 200, ref: "Pagans", msg: "logout" };
};
@ -84,7 +84,7 @@ Pagans.getalias = (alias) => {
*/
Pagans.sendmailkey = (data) => {
console.log(
if (log) console.log(currentmod,
data.alias,
"-",
data.privatekey.substring(0,10),
@ -95,7 +95,9 @@ Pagans.sendmailkey = (data) => {
"-",
data.publickey.substring(0,10),
"-",
data.email
data.email,
"-",
data.lg
);
const person = { alias:data.alias, privatekey:data.privatekey, tribe:data.tribe };
@ -122,7 +124,7 @@ Pagans.sendmailkey = (data) => {
person.avecpassphrase=(person.passphrase!="")
console.log("person:", person);
const tplemail = require(`../../nationchains/tribes/adminapi/template/createidentity_${lg}.js`)
const tplemail = require(`../../nationchains/tribes/adminapi/template/createidentity_${data.lg}.js`)
person.message
const maildata = {
@ -176,10 +178,10 @@ Pagans.authenticatedetachedSignature = async (
const { verified, keyID } = verificationResult.signatures[0];
try {
await verified; // throws on invalid signature
console.log("Signed by key id " + keyID.toHex());
if (log) console.log(currentmod,"Signed by key id " + keyID.toHex());
return KeyId.toHex().alias == alias;
} catch (e) {
console.log("Signature could not be verified: " + e.message);
if (log) console.log(currentmod,"Signature could not be verified: " + e.message);
return false;
}
};

View File

@ -205,11 +205,11 @@ router.delete("/alias/:alias", checkHeaders, isAuthenticated, (req, res) => {
};
req.session.header.role
const delperson = Odmdb.cud(personpath,"U",{alias:req.params.alias,dt_delete:dayjs().toISOString()},role,true);
console.log(`DELETE person ${personpath}/${req.params.alias}.json `);
console.log(delperson)
if (log) console.log(currentmod,`DELETE person ${personpath}/${req.params.alias}.json `);
if (log) console.log(delperson)
res.status(delperson.status).json(delperson);
console.log(`DELETE pagans nationchains/pagans/${req.params.alias}.json`);
if (log) console.log(`DELETE pagans nationchains/pagans/${req.params.alias}.json`);
const result = Pagans.delete(req.params.alias, req.session.header);
res.status(result.status).send(result);
});
@ -232,8 +232,8 @@ router.delete("/person/:tribe/:alias", checkHeaders, isAuthenticated, (req, res)
};
req.session.header.role
const delperson = Odmdb.cud(personpath,"D",{alias:req.params.alias},role,true);
console.log(`DELETE person ${personpath}/${req.params.alias}.json `);
console.log(delperson)
if (log) console.log(currentmod,`DELETE person ${personpath}/${req.params.alias}.json `);
if (log) console.log(currentmod,"delete person ",delperson)
res.status(delperson.status).json(delperson);
});
@ -282,7 +282,7 @@ router.put("/person/:tribe", checkHeaders, isAuthenticated, (req, res) => {
req.body.profils=["anonymous","pagans","persons"]
}
const personup = Odmdb.cud(pathobj, action, req.body, {xprofils:req.session.header.xprofils, xalias:req.session.header.xalias});
console.log('personup',personup)
if (log) console.log(currentmod,' personupdate or create:',personup)
res.status(personup.status).json(personup);
});