added: _ e - all'username in fase di registrazione
This commit is contained in:
@@ -167,7 +167,7 @@ module.exports = {
|
||||
|
||||
// Contribtypes
|
||||
const {Contribtype} = require('../models/contribtype');
|
||||
await this.insertIntoDb_NoDuplicate(abilita, 'contribtypes', Contribtype, 'label')
|
||||
await this.insertIntoDb_NoDuplicate(false, 'contribtypes', Contribtype, 'label')
|
||||
|
||||
const {AdType} = require('../models/adtype');
|
||||
await this.insertIntoDb_NoDuplicate(abilita, 'adtypes', AdType, 'descr')
|
||||
|
||||
@@ -91,9 +91,10 @@ router.post('/', async (req, res) => {
|
||||
|
||||
// tools.mylog("LANG PASSATO = " + user.lang, "IDAPP", user.idapp);
|
||||
|
||||
if (!tools.isAlphaNumeric(body.username) || body.email.length < 6 ||
|
||||
if (!tools.isAlphaNumericAndSpecialCharacter(body.username) || body.email.length < 6 ||
|
||||
body.username.length < 6 || body.password.length < 6) {
|
||||
await tools.snooze(5000);
|
||||
console.log('Username non valido in Registrazione: ' + body.username);
|
||||
res.status(400).
|
||||
send({code: server_constants.RIS_CODE_USERNAME_NOT_VALID, msg: ''});
|
||||
return 1;
|
||||
@@ -895,7 +896,8 @@ async function eseguiDbOp(idapp, mydata, locale) {
|
||||
|
||||
const globalTables = require('../tools/globalTables');
|
||||
|
||||
const mytablesstr = ['settings', 'users', 'templemail', 'contribtypes'];
|
||||
//++ Todo: TO FIXIT !
|
||||
const mytablesstr = ['settings', 'users', 'templemail', 'contribtypes', 'bots', 'cfgservers'];
|
||||
|
||||
try {
|
||||
let numrectot = 0;
|
||||
|
||||
@@ -2373,6 +2373,23 @@ module.exports = {
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
isAlphaNumericAndSpecialCharacter(str) {
|
||||
let code, i, len;
|
||||
|
||||
for (i = 0, len = str.length; i < len; i++) {
|
||||
code = str.charCodeAt(i);
|
||||
if (!(code > 47 && code < 58) && // numeric (0-9)
|
||||
!(code > 63 && code < 91) && // upper alpha (A-Z) // e @
|
||||
(code !== 95) && // _
|
||||
(code !== 45) && // -
|
||||
!(code > 96 && code < 123)) { // lower alpha (a-z)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
categorizeQueryString(queryObj) {
|
||||
let query = {};
|
||||
let order = {};
|
||||
|
||||
Reference in New Issue
Block a user