Nuovo Sistema di registrazione, Completato.

This commit is contained in:
Paolo Arena
2022-05-05 00:38:41 +02:00
parent 311e714d7d
commit b340d39348
5 changed files with 33 additions and 9 deletions

View File

@@ -127,10 +127,27 @@ module.exports.executeQueryTable = async function (idapp, params, userreq) {
};
module.exports.findAllIdApp = async function (idapp) {
module.exports.findAll = async function () {
const myfind = { active: true };
return Site.find(myfind).lean();
};
module.exports.findAllIdApp = async function (idapp) {
const myfind = { idapp, active: true };
let rec = await Site.findOne(myfind).lean();
if (rec) {
rec.email_pwd = '';
rec.telegram_key = '';
rec.telegram_key_test = '';
return rec;
}
return {};
};

View File

@@ -632,7 +632,7 @@ UserSchema.statics.findByUsername = async function(idapp, username, alsoemail, o
}
return ris;
}).then((rec) => {
if (onlyifVerifiedByAportador) {
if (rec && onlyifVerifiedByAportador) {
if (tools.getAskToVerifyReg(idapp)) {
if (!rec.verified_by_aportador)
return null;
@@ -1137,7 +1137,7 @@ UserSchema.statics.findByEmail = function(idapp, email, onlyifVerifiedByAportado
'email': email,
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
}).then((rec) => {
if (onlyifVerifiedByAportador) {
if (rec && onlyifVerifiedByAportador) {
if (tools.getAskToVerifyReg(idapp)) {
if (!rec.verified_by_aportador)
return null;