forked from apxtri/apxtri
add check timehhmm and pagans modifications
This commit is contained in:
parent
b58e31c5c2
commit
305e3c2645
@ -87,6 +87,7 @@ Checkjson.schema.properties.format = {
|
||||
"date-time": /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d{1,3}/,
|
||||
stringalphaonly: /^[A-Za-z0-9]{3,}$/,
|
||||
time: /[0-2]\d:[0-5]\d:[0-5]\d\.\d{1,3}/,
|
||||
timehhmm:/^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/,
|
||||
date: /\d{4}-[01]\d-[0-3]\d/,
|
||||
duration: / /,
|
||||
email:
|
||||
|
@ -49,6 +49,7 @@ Pagans.logout = (alias, tribe, xdays, xhash) => {
|
||||
*/
|
||||
|
||||
Pagans.keyrecovery = (emailalias, tribe, search, lg) => {
|
||||
if (log) console.log(currentmod,":try to recover emailalias, tribe, search, lg:",emailalias,tribe,search,lg);
|
||||
if (!["email", "alias"].includes(emailalias)) {
|
||||
return {
|
||||
status: 406,
|
||||
@ -71,12 +72,14 @@ Pagans.keyrecovery = (emailalias, tribe, search, lg) => {
|
||||
} else {
|
||||
const personpath = `../../${tribe}/objects/persons/itm/${search}.json`;
|
||||
if (fs.existsSync(personpath)) {
|
||||
const person=fs.readFileSync(personpath)
|
||||
if (person.recoveryauth)
|
||||
emaillist.push({ alias: search, tribe, lg });
|
||||
}
|
||||
}
|
||||
emaillist.forEach((e) => {
|
||||
console.log(e);
|
||||
//const ret = Pagans.sendmailkey(e);
|
||||
const ret = Pagans.sendmailkey(e);
|
||||
});
|
||||
|
||||
if (emaillist.length > 0) {
|
||||
|
@ -417,59 +417,6 @@ router.put("/person/:tribe", checkHeaders, isAuthenticated, (req, res) => {
|
||||
router.post("/keyrecovery", checkHeaders, (req, res) => {
|
||||
const recores=Pagans.keyrecovery(req.body.emailalias,req.body.tribe,req.body.search,req.session.header.xlang)
|
||||
res.status(recores.status).json(recores);
|
||||
/*
|
||||
let emailist = [];
|
||||
let alias = req.body.search;
|
||||
if (req.body.emailalias == "email") {
|
||||
req.body.search = req.body.search.toLowerCase();
|
||||
const idxreco = `../../${req.body.tribe}/objects/persons/idx/emailrecovery_alias.json`;
|
||||
if (fs.existsSync(idxreco)) {
|
||||
const emailreco = fs.readJSONSync(idxreco);
|
||||
const listalias = emailreco[req.body.search]
|
||||
? emailreco[req.body.search]
|
||||
: [];
|
||||
listalias.forEach((a) => {
|
||||
emailist.push({
|
||||
alias: a,
|
||||
tribe: req.body.tribe,
|
||||
lg: req.session.header.xlang,
|
||||
});
|
||||
});
|
||||
}
|
||||
} else if (req.body.emailalias == "alias") {
|
||||
const falias = `../../${req.body.tribe}/objects/persons/itm/${req.body.search}.json`;
|
||||
if (fs.existsSync(falias)) {
|
||||
emailist.push({
|
||||
alias: req.body.search,
|
||||
tribe: req.body.tribe,
|
||||
lg: req.session.header.xlang,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
res.status(406).json({status:406,ref:"Pagans",msg:"emailaliasnotemailoralias",data:{}})
|
||||
}
|
||||
|
||||
emailist.forEach((e) => {
|
||||
console.log(e);
|
||||
const ret = Pagans.sendmailkey(e);
|
||||
});
|
||||
|
||||
if (emailist.length > 0) {
|
||||
res.status(200).json({
|
||||
status: 200,
|
||||
ref: "Pagans",
|
||||
msg: "recoveryemailsent",
|
||||
data: { numberemailsent: emailist.length },
|
||||
});
|
||||
} else {
|
||||
res.status(404).json({
|
||||
status: 404,
|
||||
ref: "Pagans",
|
||||
msg: "recoveryemailnotfound",
|
||||
data: { tribe: req.body.tribe },
|
||||
});
|
||||
}
|
||||
*/
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
Loading…
x
Reference in New Issue
Block a user