Nuovo Sistema di registrazione, Completato.
This commit is contained in:
@@ -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 };
|
const myfind = { active: true };
|
||||||
|
|
||||||
return Site.find(myfind).lean();
|
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 {};
|
||||||
|
|
||||||
|
};
|
||||||
|
|||||||
@@ -632,7 +632,7 @@ UserSchema.statics.findByUsername = async function(idapp, username, alsoemail, o
|
|||||||
}
|
}
|
||||||
return ris;
|
return ris;
|
||||||
}).then((rec) => {
|
}).then((rec) => {
|
||||||
if (onlyifVerifiedByAportador) {
|
if (rec && onlyifVerifiedByAportador) {
|
||||||
if (tools.getAskToVerifyReg(idapp)) {
|
if (tools.getAskToVerifyReg(idapp)) {
|
||||||
if (!rec.verified_by_aportador)
|
if (!rec.verified_by_aportador)
|
||||||
return null;
|
return null;
|
||||||
@@ -1137,7 +1137,7 @@ UserSchema.statics.findByEmail = function(idapp, email, onlyifVerifiedByAportado
|
|||||||
'email': email,
|
'email': email,
|
||||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||||
}).then((rec) => {
|
}).then((rec) => {
|
||||||
if (onlyifVerifiedByAportador) {
|
if (rec && onlyifVerifiedByAportador) {
|
||||||
if (tools.getAskToVerifyReg(idapp)) {
|
if (tools.getAskToVerifyReg(idapp)) {
|
||||||
if (!rec.verified_by_aportador)
|
if (!rec.verified_by_aportador)
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ const {Province} = require('../models/province');
|
|||||||
const {Sector} = require('../models/sector');
|
const {Sector} = require('../models/sector');
|
||||||
const {SectorGood} = require('../models/sectorgood');
|
const {SectorGood} = require('../models/sectorgood');
|
||||||
const {CatGrp} = require('../models/catgrp');
|
const {CatGrp} = require('../models/catgrp');
|
||||||
|
const Site = require('../models/site');
|
||||||
const {Level} = require('../models/level');
|
const {Level} = require('../models/level');
|
||||||
const {AdType} = require('../models/adtype');
|
const {AdType} = require('../models/adtype');
|
||||||
const {AdTypeGood} = require('../models/adtypegood');
|
const {AdTypeGood} = require('../models/adtypegood');
|
||||||
@@ -1071,6 +1072,7 @@ function load(req, res, version) {
|
|||||||
let sectors = Sector.findAllIdApp(idapp);
|
let sectors = Sector.findAllIdApp(idapp);
|
||||||
let sectorgoods = SectorGood.findAllIdApp(idapp);
|
let sectorgoods = SectorGood.findAllIdApp(idapp);
|
||||||
let catgrps = CatGrp.findAllIdApp(idapp);
|
let catgrps = CatGrp.findAllIdApp(idapp);
|
||||||
|
let site = Site.findAllIdApp(idapp);
|
||||||
// let cities = City.findAllIdApp(idapp);
|
// let cities = City.findAllIdApp(idapp);
|
||||||
let provinces = Province.findAllIdApp(idapp);
|
let provinces = Province.findAllIdApp(idapp);
|
||||||
let cart = null;
|
let cart = null;
|
||||||
@@ -1135,6 +1137,7 @@ function load(req, res, version) {
|
|||||||
adtypegoods,
|
adtypegoods,
|
||||||
sectorgoods,
|
sectorgoods,
|
||||||
goods,
|
goods,
|
||||||
|
site,
|
||||||
]).then((arrdata) => {
|
]).then((arrdata) => {
|
||||||
// console.table(arrdata);
|
// console.table(arrdata);
|
||||||
let myuser = req.user;
|
let myuser = req.user;
|
||||||
@@ -1212,6 +1215,7 @@ function load(req, res, version) {
|
|||||||
adtypegoods: arrdata[32],
|
adtypegoods: arrdata[32],
|
||||||
sectorgoods: arrdata[33],
|
sectorgoods: arrdata[33],
|
||||||
goods: arrdata[34],
|
goods: arrdata[34],
|
||||||
|
site: arrdata[35],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -476,7 +476,7 @@ const txt = {
|
|||||||
MSG_SCEGLI_MENU: emoji.get('dizzy') + ' Scegli una voce di menu:' +
|
MSG_SCEGLI_MENU: emoji.get('dizzy') + ' Scegli una voce di menu:' +
|
||||||
emoji.get('dizzy'),
|
emoji.get('dizzy'),
|
||||||
MSG_ASK_USERNAME_BO: 'Scrivete nel messaggio l\'username (SENZA SPAZI) o la email con cui vi siete registrati sul sito di %s:',
|
MSG_ASK_USERNAME_BO: 'Scrivete nel messaggio l\'username (SENZA SPAZI) o la email con cui vi siete registrati sul sito di %s:',
|
||||||
MSG_ASK_USERNAME_INVITANTE: 'Scrivi l\'username di chi ti ha invitato su %s (non inserire spazi)',
|
MSG_ASK_USERNAME_INVITANTE: 'Incolla (o scrivi) l\'username di chi ti ha invitato su %s (non inserire spazi)',
|
||||||
MSG_ERRORE_INVITANTE_NOT_FOUND: 'L\'username dell\'invitante appena digitato non sembra essere corretto!',
|
MSG_ERRORE_INVITANTE_NOT_FOUND: 'L\'username dell\'invitante appena digitato non sembra essere corretto!',
|
||||||
MSG_ERRORE_USERNAME: 'Attenzione! Devi inserire solo lo username (40 caratteri massimo)',
|
MSG_ERRORE_USERNAME: 'Attenzione! Devi inserire solo lo username (40 caratteri massimo)',
|
||||||
MSG_ERRORE_USERNAME_NOT_FOUND: 'Per Completare la Verifica Telegram BOT, dovete ora scrivere qui sotto nel messaggio l\'Username (senza spazi) OPPURE la email con cui vi siete registrati sul sito',
|
MSG_ERRORE_USERNAME_NOT_FOUND: 'Per Completare la Verifica Telegram BOT, dovete ora scrivere qui sotto nel messaggio l\'Username (senza spazi) OPPURE la email con cui vi siete registrati sul sito',
|
||||||
@@ -511,7 +511,7 @@ const txt = {
|
|||||||
MSG_SET_USERNAME_TELEGRAM: '[Prima di continuare con la registrazione in RISO.APP]\n' +
|
MSG_SET_USERNAME_TELEGRAM: '[Prima di continuare con la registrazione in RISO.APP]\n' +
|
||||||
'Segui questi passi per <b>IMPOSTARE UN USERNAME IN TELEGRAM</b>: \n\n' +
|
'Segui questi passi per <b>IMPOSTARE UN USERNAME IN TELEGRAM</b>: \n\n' +
|
||||||
'1. premi sull\'icona con <b>3 linee orizzontali</b>, in alto a sinistra (sull\'iPhone si chiama "Impostazioni").\n' +
|
'1. premi sull\'icona con <b>3 linee orizzontali</b>, in alto a sinistra (sull\'iPhone si chiama "Impostazioni").\n' +
|
||||||
'Per vederlo premi INDIETRO (si chiuderà questa chat).\n\n' +
|
'premi il tasto INDIETRO del cellulare (si chiuderà questa chat).\n\n' +
|
||||||
'2. Seleziona la voce <b>IMPOSTAZIONI</b> dalla lista.\n\n' +
|
'2. Seleziona la voce <b>IMPOSTAZIONI</b> dalla lista.\n\n' +
|
||||||
'3.Premi su <b>USERNAME</b> nella sezione account.\n\n' +
|
'3.Premi su <b>USERNAME</b> nella sezione account.\n\n' +
|
||||||
'4. Digita un username (o nome utente) qualsiasi a tua scelta, se è già usato aggiungi dei numeri.\n\n' +
|
'4. Digita un username (o nome utente) qualsiasi a tua scelta, se è già usato aggiungi dei numeri.\n\n' +
|
||||||
@@ -2558,7 +2558,8 @@ class Telegram {
|
|||||||
this.asktoRegistrationByLink(msg);
|
this.asktoRegistrationByLink(msg);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
rec.status = Status.WAITFOR_USERNAME_INVITANTE;
|
// rec.status = Status.WAITFOR_USERNAME_INVITANTE;
|
||||||
|
rec.status = Status.SET_USERNAME_INVITANTE;
|
||||||
|
|
||||||
const str2 = '\n' + getstr(this.getlang(msg), 'MSG_ASK_USERNAME_INVITANTE', tools.getNomeAppByIdApp(this.idapp));
|
const str2 = '\n' + getstr(this.getlang(msg), 'MSG_ASK_USERNAME_INVITANTE', tools.getNomeAppByIdApp(this.idapp));
|
||||||
|
|
||||||
@@ -3010,12 +3011,12 @@ class Telegram {
|
|||||||
|
|
||||||
async asktoRegistrationByLink(msg) {
|
async asktoRegistrationByLink(msg) {
|
||||||
|
|
||||||
const rec = this.getRecInMem(msg);
|
let rec = this.getRecInMem(msg);
|
||||||
|
|
||||||
let visu = false;
|
let visu = false;
|
||||||
|
|
||||||
if (!rec) {
|
if (!rec) {
|
||||||
await this.addUser(msg);
|
rec = await this.addUser(msg);
|
||||||
|
|
||||||
visu = true;
|
visu = true;
|
||||||
|
|
||||||
@@ -3044,6 +3045,8 @@ class Telegram {
|
|||||||
// await this.sendMsg(msg.chat.id, getstr(this.getlang(msg), printf(txt.MSG_ASK_USERNAME_BO, tools.getHostByIdApp(this.idapp))));
|
// await this.sendMsg(msg.chat.id, getstr(this.getlang(msg), printf(txt.MSG_ASK_USERNAME_BO, tools.getHostByIdApp(this.idapp))));
|
||||||
await this.sendMsg(msg.chat.id, getstr(this.getlang(msg), 'MSG_SIGNUP', tools.getNomeAppByIdApp(this.idapp)), null, keyb);
|
await this.sendMsg(msg.chat.id, getstr(this.getlang(msg), 'MSG_SIGNUP', tools.getNomeAppByIdApp(this.idapp)), null, keyb);
|
||||||
|
|
||||||
|
} else if (status === Status.WAITFOR_USERNAME_INVITANTE) {
|
||||||
|
await this.askUsernameInvitante(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -2634,7 +2634,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async loadApps() {
|
async loadApps() {
|
||||||
this.MYAPPS = await Site.findAllIdApp(0);
|
this.MYAPPS = await Site.findAll(0);
|
||||||
// console.log('this.MYAPPS', this.MYAPPS);
|
// console.log('this.MYAPPS', this.MYAPPS);
|
||||||
},
|
},
|
||||||
getApps() {
|
getApps() {
|
||||||
|
|||||||
Reference in New Issue
Block a user