Versione 1.0.17
- Fix saldo pendente - aggiunto bottone markup Telegram - aggionta opzione per registrarsi direttamente su Telegram, senza doversi registrare ad un sito
This commit is contained in:
@@ -44,7 +44,7 @@ const UserSchema = new mongoose.Schema({
|
||||
},
|
||||
email: {
|
||||
type: String,
|
||||
required: true,
|
||||
// required: true,
|
||||
trim: true,
|
||||
minlength: 1,
|
||||
unique: false,
|
||||
@@ -2791,7 +2791,7 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
|
||||
ris = true;
|
||||
} else if ((cmd === shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT) || (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REFUSE)) {
|
||||
// Before to accept, I see if it's already set !
|
||||
|
||||
|
||||
outres = {
|
||||
cansend: false,
|
||||
errormsg: '',
|
||||
@@ -4826,6 +4826,7 @@ UserSchema.statics.getExtraInfoByUsername = async function (idapp, username) {
|
||||
UserSchema.statics.addExtraInfo = async function (idapp, recUser, recUserSave, version) {
|
||||
|
||||
try {
|
||||
tools.startTimeLog('addExtraInfo')
|
||||
|
||||
if (version) {
|
||||
let versattualeuser = 0;
|
||||
@@ -4924,6 +4925,8 @@ UserSchema.statics.addExtraInfo = async function (idapp, recUser, recUserSave, v
|
||||
|
||||
recUser.profile.calc = await User.calcOtherByUser(idapp, recUser._id);
|
||||
|
||||
tools.endTimeLog('addExtraInfo')
|
||||
|
||||
return recUser;
|
||||
|
||||
} catch (e) {
|
||||
@@ -5190,6 +5193,7 @@ UserSchema.statics.createNewSubRecord = async function (idapp, req) {
|
||||
return rec;
|
||||
};
|
||||
|
||||
|
||||
const User = mongoose.model('User', UserSchema);
|
||||
|
||||
class Hero {
|
||||
@@ -5204,6 +5208,45 @@ class Hero {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { User, Hero };
|
||||
const FuncUsers = {
|
||||
createRegistration_withTelegram(userdata) {
|
||||
|
||||
const telegrambot = require('../telegram/telegrambot');
|
||||
|
||||
try {
|
||||
// Cerca se esiste già
|
||||
const user = new User(userdata);
|
||||
|
||||
user.verified_email = false;
|
||||
user.lasttimeonline = new Date();
|
||||
user.date_reg = new Date();
|
||||
|
||||
return user.save().then(async () => {
|
||||
return User.findByUsername(user.idapp, user.username, false).
|
||||
then(async (usertrovato) => {
|
||||
|
||||
const numutenti = await User.getNumUsers(user.idapp);
|
||||
|
||||
let msg = '++ Nuovo Entrato: [' + numutenti + '] ' + user.username + ' ' + user.name + ' ' + user.surname;
|
||||
|
||||
await telegrambot.sendMsgTelegramToTheManagers(user.idapp, msg);
|
||||
|
||||
return telegrambot.askConfirmationUser(user.idapp, shared_consts.CallFunz.REGISTRATION, user, '', '', '', '');
|
||||
});
|
||||
}).catch((e) => {
|
||||
console.error(e.message);
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
module.exports = {
|
||||
User, Hero, FuncUsers
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user