- added Aportador Solidario to registration

- added email_paypal and username_telegram
This commit is contained in:
Paolo Arena
2019-12-29 01:54:00 +01:00
parent 8beb8162dd
commit cf91d45427
23 changed files with 471 additions and 292 deletions

View File

@@ -1,4 +1,3 @@
export class Patterns { export class Patterns {
/** /**
@@ -13,7 +12,11 @@ export class Patterns {
/** /**
* 6 to 20 characters string with at least one digit, one upper case letter, one lower case letter and one special symbol * 6 to 20 characters string with at least one digit, one upper case letter, one lower case letter and one special symbol
*
* public static Password: RegExp = /^((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%!\-]).{6,20})/i
*
* 8 to 20 characters string with at least one digit, one upper case letter, one lower case letter and one special symbol
*/ */
public static Password: RegExp = /^((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%!\-]).{6,20})/i public static Password: RegExp = /^((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,30})/i
} }

View File

@@ -27,7 +27,7 @@ export const shared_consts = {
}, },
fieldsUserToChange() { fieldsUserToChange() {
return ['_id', 'username', 'email', 'cell', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'img', 'ipaddr', 'lasttimeonline', 'profile', 'news_on'] return ['_id', 'username', 'email', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'img', 'ipaddr', 'lasttimeonline', 'profile', 'news_on']
} }
} }

View File

@@ -2,7 +2,7 @@
<!--<div class="q-pa-md items-start " style="display: inline-flex; width: 800px;"> --> <!--<div class="q-pa-md items-start " style="display: inline-flex; width: 800px;"> -->
<div> <div>
<div v-if="!edit"> <div v-if="!edit">
<div v-for="(mygallery, index) in listimages" :key="index" v-if="index === 0"> <div v-for="(mygallery, index) in getlistimages" :key="index" v-if="index === 0">
<div class="q-pa-md q-gutter-md"> <div class="q-pa-md q-gutter-md">
<q-card :class="getclass"> <q-card :class="getclass">
<q-img :src="getsrcimg(mygallery)" :class="getclimg" <q-img :src="getsrcimg(mygallery)" :class="getclimg"

View File

@@ -87,7 +87,7 @@ export default class CGridTableRec extends Vue {
public undoVal() { public undoVal() {
console.log('undoVal', 'colsel', this.colsel, 'valprec', this.valPrec, 'this.colkey', this.colkey, 'this.selected', this.rowsel) console.log('undoVal', 'colsel', this.colsel, 'valprec', this.valPrec, 'this.colkey', this.colkey, 'this.selected', this.rowsel)
console.table(this.serverData) // console.table(this.serverData)
if (this.colsel) { if (this.colsel) {
if (this.colsel.subfield !== '') { if (this.colsel.subfield !== '') {
if (this.rowsel[this.colsel.field] === undefined) if (this.rowsel[this.colsel.field] === undefined)
@@ -186,7 +186,7 @@ export default class CGridTableRec extends Vue {
} }
public onRequest(props) { public onRequest(props) {
console.log('onRequest', 'myfilter = ', this.myfilter) // console.log('onRequest', 'myfilter = ', this.myfilter)
const { page, rowsPerPage, rowsNumber, sortBy, descending } = props.pagination const { page, rowsPerPage, rowsNumber, sortBy, descending } = props.pagination
const myfilter = this.myfilter const myfilter = this.myfilter
@@ -225,7 +225,7 @@ export default class CGridTableRec extends Vue {
this.serverData = [...this.returnedData] this.serverData = [...this.returnedData]
} }
console.log('this.serverData', this.serverData) // console.log('this.serverData', this.serverData)
// don't forget to update local pagination object // don't forget to update local pagination object
this.pagination.page = page this.pagination.page = page
@@ -456,7 +456,7 @@ export default class CGridTableRec extends Vue {
} }
} }
console.log('this.tablesel', this.tablesel, 'mytab', mytab) // console.log('this.tablesel', this.tablesel, 'mytab', mytab)
if (mytab) { if (mytab) {
this.mytitle = mytab.label this.mytitle = mytab.label

View File

@@ -9,6 +9,7 @@ import MixinBase from '../../mixins/mixin-base'
import { fieldsTable } from '../../store/Modules/fieldsTable' import { fieldsTable } from '../../store/Modules/fieldsTable'
import { IColGridTable } from '../../model' import { IColGridTable } from '../../model'
import { CMySelect } from '../CMySelect' import { CMySelect } from '../CMySelect'
import { GlobalStore, UserStore } from '../../store/Modules'
@Component({ @Component({
name: 'CMyFieldDb', name: 'CMyFieldDb',
@@ -18,10 +19,12 @@ import { CMySelect } from '../CMySelect'
export default class CMyFieldDb extends MixinBase { export default class CMyFieldDb extends MixinBase {
@Prop({ required: true }) public title @Prop({ required: true }) public title
@Prop({ required: true }) public mykey: string @Prop({ required: true }) public mykey: string
@Prop({ required: false, default: '' }) public mysubkey: string
@Prop({ required: true }) public type: number @Prop({ required: true }) public type: number
@Prop({ required: false, default: false }) public serv: boolean @Prop({ required: false, default: false }) public serv: boolean
@Prop({ required: false, default: false }) public disable: boolean @Prop({ required: false, default: false }) public disable: boolean
@Prop({ required: false, default: '' }) public jointable: string @Prop({ required: false, default: '' }) public jointable: string
@Prop({ required: false, default: '' }) public table: string
public $t public $t
public myvalue = '' public myvalue = ''
@@ -29,7 +32,7 @@ export default class CMyFieldDb extends MixinBase {
public canEdit: boolean = true public canEdit: boolean = true
public created() { public created() {
this.myvalue = this.getValDb(this.mykey, this.serv) this.myvalue = this.getValDb(this.mykey, this.serv, '', this.table, this.mysubkey)
this.col.jointable = this.jointable this.col.jointable = this.jointable
this.col.fieldtype = this.type this.col.fieldtype = this.type
this.col.label = this.title this.col.label = this.title
@@ -95,7 +98,7 @@ export default class CMyFieldDb extends MixinBase {
public savefield(value, initialval) { public savefield(value, initialval) {
this.myvalue = value this.myvalue = value
this.setValDb(this.mykey, this.myvalue, this.type, this.serv) this.setValDb(this.mykey, this.myvalue, this.type, this.serv, this.table, this.mysubkey)
} }
} }

View File

@@ -6,6 +6,12 @@
</CGallery> </CGallery>
</div> </div>
<div v-else-if="col.fieldtype === tools.FieldType.image">
<CGallery :gall="row" :listimages="myvalue" :edit="isviewfield"
@showandsave="Savedb">
</CGallery>
</div>
<div v-else> <div v-else>
<!-- Edit Value --> <!-- Edit Value -->
<span v-if="col.fieldtype === tools.FieldType.date"> <span v-if="col.fieldtype === tools.FieldType.date">

View File

@@ -21,6 +21,7 @@ import { Logo } from '../../components/logo'
}) })
export default class CSignUp extends Vue { export default class CSignUp extends Vue {
@Prop({ required: false, default: false }) public adult: boolean
public $v public $v
public $q public $q
public $t: any public $t: any
@@ -35,14 +36,23 @@ export default class CSignUp extends Vue {
surname: process.env.TEST_SURNAME || '', surname: process.env.TEST_SURNAME || '',
password: process.env.TEST_PASSWORD || '', password: process.env.TEST_PASSWORD || '',
repeatPassword: process.env.TEST_PASSWORD || '', repeatPassword: process.env.TEST_PASSWORD || '',
terms: !process.env.PROD terms: !process.env.PROD,
} }
public created() { public created() {
this.$v.$reset() this.$v.$reset()
this.signup.aportador_solidario = tools.getCookie(tools.APORTADOR_SOLIDARIO, this.$route.params.invited || process.env.TEST_APORTADOR)
}
@Watch('$route.params.invited')
public changeaportador() {
if (!this.signup.aportador_solidario)
this.signup.aportador_solidario = this.$route.params.invited
} }
public mounted() { public mounted() {
} }
get allowSubmit() { get allowSubmit() {

View File

@@ -9,6 +9,20 @@
<!--Prova URL : {{env('PROVA_PAOLO')}}--> <!--Prova URL : {{env('PROVA_PAOLO')}}-->
<div class="q-gutter-xs"> <div class="q-gutter-xs">
<q-input
:readonly="true"
v-model="signup.aportador_solidario"
rounded outlined dense
bottom-slots
:label="$t('reg.aportador_solidario')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input <q-input
v-model="signup.email" v-model="signup.email"
rounded outlined rounded outlined
@@ -116,6 +130,17 @@
:label="$t('reg.terms')"> :label="$t('reg.terms')">
</q-checkbox> </q-checkbox>
<q-checkbox
v-if="adult"
v-model="signup.onlyadult"
color="secondary"
@blur="$v.signup.onlyadult.$touch"
:error="$v.signup.onlyadult.$error"
:error-message="`${errorMsg('onlyadult', $v.signup.onlyadult)}`"
:label="$t('reg.onlyadult')">
</q-checkbox>
<br> <br>
<div class="wrapper"> <div class="wrapper">

View File

@@ -308,7 +308,7 @@ export default class Header extends Vue {
} }
get getappname() { get getappname() {
return tools.getappname(this, tools.isMobile()) return tools.getsuffisso() + tools.getappname(this, tools.isMobile())
} }
public toggleanimation() { public toggleanimation() {
@@ -368,4 +368,13 @@ export default class Header extends Vue {
this.rightDrawerOpen = false this.rightDrawerOpen = false
this.$router.replace('/signup') this.$router.replace('/signup')
} }
get getClassColorHeader() {
if (tools.isTest())
return 'bg-warning'
else if (tools.isDebug())
return 'bg-info'
else
return 'bg-primary'
}
} }

View File

@@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<q-header reveal elevated class="bg-primary"> <q-header reveal elevated :class="getClassColorHeader">
<q-toolbar <q-toolbar
color="primary" color="primary"
:glossy="$q.theme === 'mat'" :glossy="$q.theme === 'mat'"
@@ -155,8 +155,8 @@
<!--<span class="text-white background-red" v-else> {{$t('reg.non_verificato')}} </span>--> <!--<span class="text-white background-red" v-else> {{$t('reg.non_verificato')}} </span>-->
<div v-if="isLogged" id="user-actions" class="text-center"> <div v-if="isLogged" id="user-actions" class="text-center">
<q-btn round color="primary" icon="person"></q-btn> <q-btn round color="primary" icon="person" to="/profile"></q-btn>
<q-btn round color="warning" icon="lock"></q-btn> <!--<q-btn round color="warning" icon="lock"></q-btn>-->
<q-btn round color="secondary" icon="exit_to_app" @click='logoutHandler'></q-btn> <q-btn round color="secondary" icon="exit_to_app" @click='logoutHandler'></q-btn>
</div> </div>

View File

@@ -35,3 +35,4 @@ export * from './CGoogleMap'
export * from './COpenStreetMap' export * from './COpenStreetMap'
export * from './CTitleBanner' export * from './CTitleBanner'
export * from './CGallery' export * from './CGallery'
export * from './CProfile'

View File

@@ -4,7 +4,7 @@ import Component from 'vue-class-component'
import { func_tools } from '../store/Modules/toolsext' import { func_tools } from '../store/Modules/toolsext'
import { tools } from '../store/Modules/tools' import { tools } from '../store/Modules/tools'
import { toolsext } from '@src/store/Modules/toolsext' import { toolsext } from '@src/store/Modules/toolsext'
import { GlobalStore } from '../store/Modules' import { GlobalStore, UserStore } from '../store/Modules'
import { fieldsTable } from '@src/store/Modules/fieldsTable' import { fieldsTable } from '@src/store/Modules/fieldsTable'
import { CalendarStore } from '@store' import { CalendarStore } from '@store'
import MixinMetaTags from '@src/mixins/mixin-metatags' import MixinMetaTags from '@src/mixins/mixin-metatags'
@@ -16,6 +16,10 @@ export default class MixinBase extends MixinMetaTags {
return this return this
} }
public showNotif(msg) {
tools.showNotif(this.$q, this.$t(msg))
}
get toolsext() { get toolsext() {
return toolsext return toolsext
} }
@@ -32,7 +36,14 @@ export default class MixinBase extends MixinMetaTags {
return tools return tools
} }
public getValDb(keystr, serv, def?) { public getValDb(keystr, serv, def?, table?, subkey?) {
if (table === 'users') {
if (keystr === 'profile') {
return UserStore.state.my.profile[subkey]
} else {
return UserStore.state.my[keystr]
}
}else {
const ris = GlobalStore.getters.getValueSettingsByKey(keystr, serv) const ris = GlobalStore.getters.getValueSettingsByKey(keystr, serv)
if (ris === '') if (ris === '')
if (def !== undefined) if (def !== undefined)
@@ -43,9 +54,39 @@ export default class MixinBase extends MixinMetaTags {
return ris return ris
} }
public async setValDb(key, value, type, serv: boolean) { }
console.log('setValDb', key, value, serv) public async setValDb(key, value, type, serv: boolean, table?, subkey?) {
console.log('setValDb', key, value, serv, table, subkey)
let mydatatosave = null
if (table === 'users') {
const myid = UserStore.state.my._id
let myfield = {}
if (key === 'profile') {
UserStore.state.my.profile[subkey] = value
} else {
UserStore.state.my[key] = value
}
// Save to the DB:
if (subkey) {
myfield[key + '.' + subkey] = value
} else {
myfield[key] = value
}
console.log('myfield', myfield)
mydatatosave = {
id: myid,
table,
fieldsvalue: myfield
}
} else {
GlobalStore.mutations.setValueSettingsByKey({ key, value, serv }) GlobalStore.mutations.setValueSettingsByKey({ key, value, serv })
let myrec = GlobalStore.getters.getrecSettingsByKey(key, serv) let myrec = GlobalStore.getters.getrecSettingsByKey(key, serv)
@@ -79,11 +120,12 @@ export default class MixinBase extends MixinMetaTags {
} }
console.log('myrec', myrec) console.log('myrec', myrec)
const mydatatosave = { mydatatosave = {
id: myrec._id, id: myrec._id,
table: 'settings', table: 'settings',
fieldsvalue: myrec fieldsvalue: myrec
} }
}
console.log('mydatatosave', mydatatosave) console.log('mydatatosave', mydatatosave)

View File

@@ -302,6 +302,7 @@ export interface IParamDialog {
export interface IFunctionality { export interface IFunctionality {
PWA?: boolean PWA?: boolean
ENABLE_REGISTRATION?: boolean ENABLE_REGISTRATION?: boolean
SHOW_PROFILE?: boolean
SHOW_USER_MENU?: boolean SHOW_USER_MENU?: boolean
SHOW_IF_IS_SERVER_CONNECTION?: boolean SHOW_IF_IS_SERVER_CONNECTION?: boolean
ENABLE_TODOS_LOADING?: boolean ENABLE_TODOS_LOADING?: boolean

View File

@@ -11,6 +11,8 @@ export interface IUserProfile {
cell?: string cell?: string
dateofbirth?: Date dateofbirth?: Date
sex?: ESexType sex?: ESexType
email_paypal?: string
username_telegram?: string
} }
export interface IUserFields { export interface IUserFields {

View File

@@ -8,4 +8,5 @@ export interface ISignupOptions {
lang?: string lang?: string
repeatPassword?: string repeatPassword?: string
terms?: boolean terms?: boolean
aportador_solidario?: string
} }

View File

@@ -105,11 +105,14 @@ const msgglobal = {
options: 'Opzioni', options: 'Opzioni',
}, },
reg: { reg: {
aportador_solidario: 'Chi ti ha Invitato',
page_title: 'Registrazione', page_title: 'Registrazione',
incorso: 'Registrazione in corso...', incorso: 'Registrazione in corso...',
richiesto: 'Campo Richiesto', richiesto: 'Campo Richiesto',
email: 'Email', email: 'Email',
cell: 'Telefono', cell: 'Telefono',
email_paypal: 'Email Paypal',
username_telegram: 'Username Telegram',
img: 'Immagine', img: 'Immagine',
date_reg: 'Data Reg.', date_reg: 'Data Reg.',
perm: 'Permessi', perm: 'Permessi',
@@ -120,6 +123,7 @@ const msgglobal = {
password: 'Password', password: 'Password',
repeatPassword: 'Ripeti password', repeatPassword: 'Ripeti password',
terms: "Accetto i termini e le condizioni", terms: "Accetto i termini e le condizioni",
onlyadult: "Confermo di essere Maggiorenne",
submit: "Registrati", submit: "Registrati",
title_verif_reg: "Verifica Registrazione", title_verif_reg: "Verifica Registrazione",
verificato: "Verificato", verificato: "Verificato",
@@ -130,7 +134,8 @@ const msgglobal = {
email: 'inserire una email valida', email: 'inserire una email valida',
errore_generico: 'Si prega di compilare correttamente i campi', errore_generico: 'Si prega di compilare correttamente i campi',
atleast: 'dev\'essere lungo almeno di', atleast: 'dev\'essere lungo almeno di',
complexity: 'deve contenere almeno 1 minuscola, 1 maiuscola, 1 cifra e 1 carattere speciale (!,$,#,%,-) ', // complexity: 'deve contenere almeno 1 minuscola, 1 maiuscola, 1 cifra e 1 carattere speciale (!,$,#,%,-) ',
complexity: 'deve contenere almeno 1 minuscola, 1 maiuscola, 1 cifra',
notmore: 'non dev\'essere lungo più di', notmore: 'non dev\'essere lungo più di',
char: 'caratteri', char: 'caratteri',
terms: 'Devi accettare le condizioni, per continuare.', terms: 'Devi accettare le condizioni, per continuare.',
@@ -469,11 +474,14 @@ const msgglobal = {
options: 'Opciones', options: 'Opciones',
}, },
reg: { reg: {
aportador_solidario: 'Aportador Solidario',
page_title: 'Registro', page_title: 'Registro',
incorso: 'Registro en curso...', incorso: 'Registro en curso...',
richiesto: 'Campo requerido', richiesto: 'Campo requerido',
email: 'Email', email: 'Email',
cell: 'Móvil', cell: 'Móvil',
email_paypal: 'Email Paypal',
username_telegram: 'Usuario Telegram',
img: 'File image', img: 'File image',
date_reg: 'Fecha Reg.', date_reg: 'Fecha Reg.',
perm: 'Permisos', perm: 'Permisos',
@@ -484,6 +492,7 @@ const msgglobal = {
password: 'contraseña', password: 'contraseña',
repeatPassword: 'Repetir contraseña', repeatPassword: 'Repetir contraseña',
terms: "Acepto los términos y condiciones", terms: "Acepto los términos y condiciones",
onlyadult: "Confirmo que soy mayor de edad",
submit: "Registrarse", submit: "Registrarse",
title_verif_reg: "Verifica registro", title_verif_reg: "Verifica registro",
verificato: "Verificado", verificato: "Verificado",
@@ -494,7 +503,7 @@ const msgglobal = {
email: 'Debe ser una email válida.', email: 'Debe ser una email válida.',
errore_generico: 'Por favor, rellene los campos correctamente', errore_generico: 'Por favor, rellene los campos correctamente',
atleast: 'debe ser al menos largo', atleast: 'debe ser al menos largo',
complexity: 'debe contener al menos 1 minúscula, 1 mayúscula, 1 dígito y 1 caractér especial (!,$,#,%,-)', complexity: 'debe contener al menos 1 minúscula, 1 mayúscula, 1 dígito',
notmore: 'no tiene que ser más largo que', notmore: 'no tiene que ser más largo que',
char: 'caracteres', char: 'caracteres',
terms: 'Debes aceptar las condiciones, para continuar..', terms: 'Debes aceptar las condiciones, para continuar..',
@@ -824,10 +833,13 @@ const msgglobal = {
options: 'Options', options: 'Options',
}, },
reg: { reg: {
aportador_solidario: 'Contributeur de solidarité',
incorso: 'Inscription en cours...', incorso: 'Inscription en cours...',
richiesto: 'Champ obligatoire', richiesto: 'Champ obligatoire',
email: 'Email', email: 'Email',
cell: 'Téléphone', cell: 'Téléphone',
email_paypal: 'Email Paypal',
username_telegram: 'Nom d\'utilisateur du Telegram',
img: 'Fichier image', img: 'Fichier image',
date_reg: 'Date Inscript.', date_reg: 'Date Inscript.',
perm: 'Autorisations', perm: 'Autorisations',
@@ -838,6 +850,7 @@ const msgglobal = {
password: 'mot de passe', password: 'mot de passe',
repeatPassword: 'Répéter le mot de passe', repeatPassword: 'Répéter le mot de passe',
terms: "J'accepte les termes et conditions", terms: "J'accepte les termes et conditions",
onlyadult: "Je confirme que je suis majeur",
submit: "S'inscrire", submit: "S'inscrire",
title_verif_reg: "Vérifier l'inscription", title_verif_reg: "Vérifier l'inscription",
verificato: "Vérifié", verificato: "Vérifié",
@@ -848,7 +861,7 @@ const msgglobal = {
email: 'Ce doit être un email valide.', email: 'Ce doit être un email valide.',
errore_generico: 'S\'il vous plaît remplir les champs correctement', errore_generico: 'S\'il vous plaît remplir les champs correctement',
atleast: 'ça doit être au moins long', atleast: 'ça doit être au moins long',
complexity: 'doit contenir au moins 1 minuscule, 1 majuscule, 1 chiffre et 1 caractère spécial (!,$,#,%,-)', complexity: 'doit contenir au moins 1 minuscule, 1 majuscule, 1 chiffre',
notmore: 'il ne doit pas être plus long que', notmore: 'il ne doit pas être plus long que',
char: 'caractères', char: 'caractères',
terms: 'Vous devez accepter les conditions, pour continuer..', terms: 'Vous devez accepter les conditions, pour continuer..',
@@ -1178,10 +1191,13 @@ const msgglobal = {
options: 'Options', options: 'Options',
}, },
reg: { reg: {
aportador_solidario: 'Solidarity Contributor',
incorso: 'Registration please wait...', incorso: 'Registration please wait...',
richiesto: 'Field Required', richiesto: 'Field Required',
email: 'Email', email: 'Email',
cell: 'Phone', cell: 'Phone',
email_paypal: 'Email Paypal',
username_telegram: 'Username Telegram',
img: 'File Image', img: 'File Image',
date_reg: 'Reg. Date', date_reg: 'Reg. Date',
perm: 'Permissions', perm: 'Permissions',
@@ -1192,6 +1208,7 @@ const msgglobal = {
password: 'Password', password: 'Password',
repeatPassword: 'Repeat password', repeatPassword: 'Repeat password',
terms: "I agree with the terms and conditions", terms: "I agree with the terms and conditions",
onlyadult: "I confirm that I'm at least 18 years old",
submit: "Submit", submit: "Submit",
title_verif_reg: "Verify Registration", title_verif_reg: "Verify Registration",
verificato: "Verified", verificato: "Verified",
@@ -1202,7 +1219,7 @@ const msgglobal = {
email: 'must be a valid email', email: 'must be a valid email',
errore_generico: 'Please review fields again', errore_generico: 'Please review fields again',
atleast: 'must be at least', atleast: 'must be at least',
complexity: 'must contains at least 1 lowercase letter, 1 uppercase letter, 1 digit and one special symbol (!,$,#,%,-)', complexity: 'must contains at least 1 lowercase letter, 1 uppercase letter, 1 digit',
notmore: 'must not be more than', notmore: 'must not be more than',
char: 'characters long', char: 'characters long',
terms: 'You need to agree with the terms & conditions.', terms: 'You need to agree with the terms & conditions.',
@@ -1531,11 +1548,14 @@ const msgglobal = {
options: 'Options', options: 'Options',
}, },
reg: { reg: {
aportador_solidario: 'Solidarity Contributor',
page_title: 'Registration', page_title: 'Registration',
incorso: 'Registration please wait...', incorso: 'Registration please wait...',
richiesto: 'Field Required', richiesto: 'Field Required',
email: 'Email', email: 'Email',
cell: 'Phone', cell: 'Phone',
email_paypal: 'Email Paypal',
username_telegram: 'Username Telegram',
img: 'File Image', img: 'File Image',
date_reg: 'Reg. Date', date_reg: 'Reg. Date',
perm: 'Permissions', perm: 'Permissions',
@@ -1546,6 +1566,7 @@ const msgglobal = {
password: 'Password', password: 'Password',
repeatPassword: 'Repeat password', repeatPassword: 'Repeat password',
terms: "I agree with the terms and conditions", terms: "I agree with the terms and conditions",
onlyadult: "I confirm that I'm at least 18 years old",
submit: "Submit", submit: "Submit",
title_verif_reg: "Verify Registration", title_verif_reg: "Verify Registration",
verificato: "Verified", verificato: "Verified",
@@ -1556,7 +1577,7 @@ const msgglobal = {
email: 'must be a valid email', email: 'must be a valid email',
errore_generico: 'Please review fields again', errore_generico: 'Please review fields again',
atleast: 'must be at least', atleast: 'must be at least',
complexity: 'must contains at least 1 lowercase letter, 1 uppercase letter, 1 digit and one special symbol (!,$,#,%,-)', complexity: 'must contains at least 1 lowercase letter, 1 uppercase letter, 1 digit',
notmore: 'must not be more than', notmore: 'must not be more than',
char: 'characters long', char: 'characters long',
terms: 'You need to agree with the terms & conditions.', terms: 'You need to agree with the terms & conditions.',

View File

@@ -800,6 +800,12 @@ namespace Actions {
GlobalStore.state.mypage = (res.data.mypage) ? [...res.data.mypage] : [] GlobalStore.state.mypage = (res.data.mypage) ? [...res.data.mypage] : []
} }
if (res.data.myuser) {
UserStore.mutations.authUser(res.data.myuser)
UserStore.mutations.updateLocalStorage(res.data.myuser)
}
CalendarStore.state.editable = UserStore.state.isAdmin || UserStore.state.isManager CalendarStore.state.editable = UserStore.state.isAdmin || UserStore.state.isManager
}) })

View File

@@ -1,5 +1,5 @@
import Api from '@api' import Api from '@api'
import { ISignupOptions, ISigninOptions, IUserState, IUserFields } from 'model' import { ISignupOptions, ISigninOptions, IUserState, IUserFields, IUserProfile } from 'model'
import { ILinkReg, IResult, IIdToken, IToken } from 'model/other' import { ILinkReg, IResult, IIdToken, IToken } from 'model/other'
import { storeBuilder } from './Store/Store' import { storeBuilder } from './Store/Store'
import router from '@router' import router from '@router'
@@ -34,6 +34,15 @@ const DefaultUser: IUserFields = {
} }
} }
const DefaultProfile: IUserProfile = {
img: '',
cell: '',
dateofbirth: new Date(),
sex: 0,
email_paypal: '',
username_telegram: ''
}
// State // State
const state: IUserState = { const state: IUserState = {
my: DefaultUser, my: DefaultUser,
@@ -203,6 +212,9 @@ namespace Getters {
namespace Mutations { namespace Mutations {
function authUser(mystate: IUserState, data: IUserFields) { function authUser(mystate: IUserState, data: IUserFields) {
mystate.my = { ...data } mystate.my = { ...data }
if (!mystate.my.profile) {
mystate.my.profile = DefaultProfile
}
mystate.isAdmin = tools.isBitActive(mystate.my.perm, shared_consts.Permissions.Admin.value) mystate.isAdmin = tools.isBitActive(mystate.my.perm, shared_consts.Permissions.Admin.value)
mystate.isManager = tools.isBitActive(mystate.my.perm, shared_consts.Permissions.Manager.value) mystate.isManager = tools.isBitActive(mystate.my.perm, shared_consts.Permissions.Manager.value)
@@ -231,6 +243,29 @@ namespace Mutations {
mystate.my.password = newstr mystate.my.password = newstr
} }
function updateLocalStorage(mystate: IUserState, myuser: IUserFields) {
const now = tools.getDateNow()
// const expirationDate = new Date(now.getTime() + myres.data.expiresIn * 1000);
const expirationDate = new Date(now.getTime() * 1000)
localStorage.setItem(tools.localStorage.lang, state.lang)
localStorage.setItem(tools.localStorage.userId, myuser._id)
localStorage.setItem(tools.localStorage.username, myuser.username)
localStorage.setItem(tools.localStorage.name, myuser.name)
localStorage.setItem(tools.localStorage.surname, myuser.surname)
localStorage.setItem(tools.localStorage.perm, String(myuser.perm) || '')
if (myuser.profile !== undefined)
localStorage.setItem(tools.localStorage.img, (!!myuser.profile.img) ? String(myuser.profile.img) || '' : '')
else
localStorage.setItem(tools.localStorage.img, '')
localStorage.setItem(tools.localStorage.token, state.x_auth_token)
localStorage.setItem(tools.localStorage.expirationDate, expirationDate.toString())
localStorage.setItem(tools.localStorage.isLogged, String(true))
localStorage.setItem(tools.localStorage.verified_email, String(myuser.verified_email))
localStorage.setItem(tools.localStorage.wasAlreadySubOnDb, String(GlobalStore.state.wasAlreadySubOnDb))
}
function setusersList(mystate: IUserState, usersList: IUserFields[]) { function setusersList(mystate: IUserState, usersList: IUserFields[]) {
// console.log('setusersList', usersList) // console.log('setusersList', usersList)
mystate.usersList = [...usersList] mystate.usersList = [...usersList]
@@ -325,6 +360,7 @@ namespace Mutations {
} }
export const mutations = { export const mutations = {
updateLocalStorage: b.commit(updateLocalStorage),
authUser: b.commit(authUser), authUser: b.commit(authUser),
setpassword: b.commit(setpassword), setpassword: b.commit(setpassword),
setemail: b.commit(setemail), setemail: b.commit(setemail),
@@ -609,24 +645,7 @@ namespace Actions {
Mutations.mutations.authUser(myuser) Mutations.mutations.authUser(myuser)
const now = tools.getDateNow() Mutations.mutations.updateLocalStorage(myuser)
// const expirationDate = new Date(now.getTime() + myres.data.expiresIn * 1000);
const expirationDate = new Date(now.getTime() * 1000)
localStorage.setItem(tools.localStorage.lang, state.lang)
localStorage.setItem(tools.localStorage.userId, myuser._id)
localStorage.setItem(tools.localStorage.username, myuser.username)
localStorage.setItem(tools.localStorage.name, myuser.name)
localStorage.setItem(tools.localStorage.surname, myuser.surname)
localStorage.setItem(tools.localStorage.perm, String(myuser.perm) || '')
if (myuser.profile !== undefined)
localStorage.setItem(tools.localStorage.img, (!!myuser.profile.img) ? String(myuser.profile.img) || '' : '')
else
localStorage.setItem(tools.localStorage.img, '')
localStorage.setItem(tools.localStorage.token, state.x_auth_token)
localStorage.setItem(tools.localStorage.expirationDate, expirationDate.toString())
localStorage.setItem(tools.localStorage.isLogged, String(true))
localStorage.setItem(tools.localStorage.verified_email, String(myuser.verified_email))
localStorage.setItem(tools.localStorage.wasAlreadySubOnDb, String(GlobalStore.state.wasAlreadySubOnDb))
} }
} }
@@ -739,6 +758,7 @@ namespace Actions {
const token = localStorage.getItem(tools.localStorage.token) const token = localStorage.getItem(tools.localStorage.token)
if (token) { if (token) {
const expirationDateStr = localStorage.getItem(tools.localStorage.expirationDate) const expirationDateStr = localStorage.getItem(tools.localStorage.expirationDate)
const expirationDate = new Date(String(expirationDateStr)) const expirationDate = new Date(String(expirationDateStr))
const now = tools.getDateNow() const now = tools.getDateNow()
@@ -753,7 +773,7 @@ namespace Actions {
GlobalStore.state.wasAlreadySubOnDb = localStorage.getItem(tools.localStorage.wasAlreadySubOnDb) === 'true' GlobalStore.state.wasAlreadySubOnDb = localStorage.getItem(tools.localStorage.wasAlreadySubOnDb) === 'true'
console.log('************* autologin _id', _id) // console.log('************* autologin _id', _id)
UserStore.mutations.setAuth(token) UserStore.mutations.setAuth(token)

View File

@@ -378,7 +378,9 @@ export const fieldsTable = {
AddCol({ name: 'name', label_trans: 'reg.name' }), AddCol({ name: 'name', label_trans: 'reg.name' }),
AddCol({ name: 'surname', label_trans: 'reg.surname' }), AddCol({ name: 'surname', label_trans: 'reg.surname' }),
AddCol({ name: 'email', label_trans: 'reg.email' }), AddCol({ name: 'email', label_trans: 'reg.email' }),
AddCol({ name: 'cell', label_trans: 'reg.cell' }), AddCol({ name: 'profile.cell', field: 'profile', subfield: 'cell', label_trans: 'reg.cell' }),
AddCol({ name: 'profile.email_paypal', field: 'profile', subfield: 'email_paypal', label_trans: 'reg.email_paypal' }),
AddCol({ name: 'profile.username_telegram', field: 'profile', subfield: 'username_telegram', label_trans: 'reg.username_telegram' }),
AddCol({ name: 'profile.img', field: 'profile', subfield: 'img', label_trans: 'reg.img', sortable: false }), AddCol({ name: 'profile.img', field: 'profile', subfield: 'img', label_trans: 'reg.img', sortable: false }),
AddCol({ name: 'date_reg', label_trans: 'reg.date_reg', fieldtype: tools.FieldType.date }), AddCol({ name: 'date_reg', label_trans: 'reg.date_reg', fieldtype: tools.FieldType.date }),
// AddCol({ name: 'idapp', label_trans: 'reg.idapp', fieldtype: tools.FieldType.string }), // AddCol({ name: 'idapp', label_trans: 'reg.idapp', fieldtype: tools.FieldType.string }),

View File

@@ -47,6 +47,8 @@ export interface INotify {
export const tools = { export const tools = {
CAN_EDIT: 'q-ce', CAN_EDIT: 'q-ce',
APORTADOR_SOLIDARIO: 'apsol',
listBestColor: [ listBestColor: [
'blue', 'blue',
'green', 'green',
@@ -141,6 +143,7 @@ export const tools = {
multiselect: 256, multiselect: 256,
password: 512, password: 512,
listimages: 1024, listimages: 1024,
image: 2048,
}, },
FieldTypeArr: [ FieldTypeArr: [
@@ -2123,6 +2126,7 @@ export const tools = {
, ,
heightgallery(coeff) { heightgallery(coeff) {
// console.log('heightgallery')
return tools.heightGallVal(coeff).toString() + 'px' return tools.heightGallVal(coeff).toString() + 'px'
} }
, ,
@@ -2694,6 +2698,7 @@ export const tools = {
}, },
getheightbywidth(mythis, mywidth, myheight, maxwidth) { getheightbywidth(mythis, mywidth, myheight, maxwidth) {
console.log('getheightbywidth')
const myw = this.getwidthscale(mythis, mywidth, maxwidth) const myw = this.getwidthscale(mythis, mywidth, maxwidth)
return myw * (myheight / mywidth) return myw * (myheight / mywidth)
}, },
@@ -2811,10 +2816,16 @@ export const tools = {
else else
return '' return ''
}, },
getsuffisso() {
if (tools.isTest())
return 'TEST: '
else
return ''
},
metafunc(mythis) { metafunc(mythis) {
return { return {
title: mythis.$t('msg.myAppName'), title: mythis.$t('msg.myAppName'),
titleTemplate: (title) => `${mythis.mymeta.title} - ${mythis.$t('msg.myAppName')}`, titleTemplate: (title) => `${tools.getsuffisso()} ${mythis.mymeta.title} - ${mythis.$t('msg.myAppName')}`,
meta: { meta: {
keywords: { keywords: {
name: 'keywords', name: 'keywords',
@@ -2836,6 +2847,10 @@ export const tools = {
return process.env.DEV return process.env.DEV
}, },
isTest() {
return process.env.ISTEST === '1'
},
geturlupload() { geturlupload() {
return process.env.MONGODB_HOST + '/upload' return process.env.MONGODB_HOST + '/upload'
}, },

View File

@@ -11,5 +11,17 @@ import { CSignUp } from '../../../components/CSignUp'
export default class Signup extends Vue { export default class Signup extends Vue {
public $t: any public $t: any
public adult: boolean = false
@Watch('$route.params.invited')
public changeadult() {
console.log('$route.params.invited')
this.adult = !!this.$route.params.invited
}
public created() {
if (!tools.getCookie(tools.APORTADOR_SOLIDARIO, ''))
tools.setCookie(tools.APORTADOR_SOLIDARIO, this.$route.params.invited)
}
} }

View File

@@ -1,6 +1,6 @@
<template> <template>
<q-page padding class="signup"> <q-page padding class="signup">
<CSignUp> <CSignUp :adult="adult">
</CSignUp> </CSignUp>
</q-page> </q-page>