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 };
|
||||
|
||||
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;
|
||||
}).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;
|
||||
|
||||
@@ -45,6 +45,7 @@ const {Province} = require('../models/province');
|
||||
const {Sector} = require('../models/sector');
|
||||
const {SectorGood} = require('../models/sectorgood');
|
||||
const {CatGrp} = require('../models/catgrp');
|
||||
const Site = require('../models/site');
|
||||
const {Level} = require('../models/level');
|
||||
const {AdType} = require('../models/adtype');
|
||||
const {AdTypeGood} = require('../models/adtypegood');
|
||||
@@ -1071,6 +1072,7 @@ function load(req, res, version) {
|
||||
let sectors = Sector.findAllIdApp(idapp);
|
||||
let sectorgoods = SectorGood.findAllIdApp(idapp);
|
||||
let catgrps = CatGrp.findAllIdApp(idapp);
|
||||
let site = Site.findAllIdApp(idapp);
|
||||
// let cities = City.findAllIdApp(idapp);
|
||||
let provinces = Province.findAllIdApp(idapp);
|
||||
let cart = null;
|
||||
@@ -1135,6 +1137,7 @@ function load(req, res, version) {
|
||||
adtypegoods,
|
||||
sectorgoods,
|
||||
goods,
|
||||
site,
|
||||
]).then((arrdata) => {
|
||||
// console.table(arrdata);
|
||||
let myuser = req.user;
|
||||
@@ -1212,6 +1215,7 @@ function load(req, res, version) {
|
||||
adtypegoods: arrdata[32],
|
||||
sectorgoods: arrdata[33],
|
||||
goods: arrdata[34],
|
||||
site: arrdata[35],
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -476,7 +476,7 @@ const txt = {
|
||||
MSG_SCEGLI_MENU: emoji.get('dizzy') + ' Scegli una voce di menu:' +
|
||||
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_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_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',
|
||||
@@ -511,7 +511,7 @@ const txt = {
|
||||
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' +
|
||||
'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' +
|
||||
'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' +
|
||||
@@ -2558,7 +2558,8 @@ class Telegram {
|
||||
this.asktoRegistrationByLink(msg);
|
||||
|
||||
} 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));
|
||||
|
||||
@@ -3010,12 +3011,12 @@ class Telegram {
|
||||
|
||||
async asktoRegistrationByLink(msg) {
|
||||
|
||||
const rec = this.getRecInMem(msg);
|
||||
let rec = this.getRecInMem(msg);
|
||||
|
||||
let visu = false;
|
||||
|
||||
if (!rec) {
|
||||
await this.addUser(msg);
|
||||
rec = await this.addUser(msg);
|
||||
|
||||
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), 'MSG_SIGNUP', tools.getNomeAppByIdApp(this.idapp)), null, keyb);
|
||||
|
||||
} else if (status === Status.WAITFOR_USERNAME_INVITANTE) {
|
||||
await this.askUsernameInvitante(msg);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -2634,7 +2634,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
async loadApps() {
|
||||
this.MYAPPS = await Site.findAllIdApp(0);
|
||||
this.MYAPPS = await Site.findAll(0);
|
||||
// console.log('this.MYAPPS', this.MYAPPS);
|
||||
},
|
||||
getApps() {
|
||||
|
||||
Reference in New Issue
Block a user