- 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,19 +1,22 @@
export class Patterns {
/**
* Alphanumeric, spaces and dashes allowed. Min 2 characters length.
*/
public static DisplayName: RegExp = /^[0-9a-zA-Z\s\-]{2,}/i
/**
* Alphanumeric, spaces and dashes allowed. Min 2 characters length.
*/
public static DisplayName: RegExp = /^[0-9a-zA-Z\s\-]{2,}/i
/**
* Same pattern used by JQuery userName validation
*/
public static Email: RegExp = /^((“[\w-\s]+”)|([\w-]+(?:\.[\w-]+)*)|(“[\w-\s]+”)([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}[0-9];{1,2})\]?$)/i
/**
* Same pattern used by JQuery userName validation
*/
public static Email: RegExp = /^((“[\w-\s]+”)|([\w-]+(?:\.[\w-]+)*)|(“[\w-\s]+”)([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}[0-9];{1,2})\]?$)/i
/**
* 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
/**
* 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]).{8,30})/i
}

View File

@@ -27,7 +27,7 @@ export const shared_consts = {
},
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>
<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">
<q-card :class="getclass">
<q-img :src="getsrcimg(mygallery)" :class="getclimg"

View File

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

View File

@@ -9,6 +9,7 @@ import MixinBase from '../../mixins/mixin-base'
import { fieldsTable } from '../../store/Modules/fieldsTable'
import { IColGridTable } from '../../model'
import { CMySelect } from '../CMySelect'
import { GlobalStore, UserStore } from '../../store/Modules'
@Component({
name: 'CMyFieldDb',
@@ -18,10 +19,12 @@ import { CMySelect } from '../CMySelect'
export default class CMyFieldDb extends MixinBase {
@Prop({ required: true }) public title
@Prop({ required: true }) public mykey: string
@Prop({ required: false, default: '' }) public mysubkey: string
@Prop({ required: true }) public type: number
@Prop({ required: false, default: false }) public serv: boolean
@Prop({ required: false, default: false }) public disable: boolean
@Prop({ required: false, default: '' }) public jointable: string
@Prop({ required: false, default: '' }) public table: string
public $t
public myvalue = ''
@@ -29,7 +32,7 @@ export default class CMyFieldDb extends MixinBase {
public canEdit: boolean = true
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.fieldtype = this.type
this.col.label = this.title
@@ -95,7 +98,7 @@ export default class CMyFieldDb extends MixinBase {
public savefield(value, initialval) {
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>
</div>
<div v-else-if="col.fieldtype === tools.FieldType.image">
<CGallery :gall="row" :listimages="myvalue" :edit="isviewfield"
@showandsave="Savedb">
</CGallery>
</div>
<div v-else>
<!-- Edit Value -->
<span v-if="col.fieldtype === tools.FieldType.date">

View File

@@ -1,73 +1,73 @@
<template>
<div>
<div class="text-center">
<p>
<logo></logo>
</p>
<div>
<div class="text-center">
<p>
<logo></logo>
</p>
</div>
<!--Prova URL : {{env('PROVA_PAOLO')}}-->
<form>
<div class="q-gutter-xs">
<q-input
v-model="signin.username"
rounded outlined dense
@blur="$v.signin.username.$touch"
:error="$v.signin.username.$error"
:error-message="`${errorMsg('username', $v.signin.username)}`"
:label="$t('reg.username_login')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signin.password"
type="password"
rounded outlined dense
@blur="$v.signin.password.$touch"
:error="$v.signin.password.$error"
:error-message="`${errorMsg('password', $v.signin.password)}`"
:label="$t('reg.password')">
<template v-slot:prepend>
<q-icon name="vpn_key"/>
</template>
</q-input>
<div class="text-center" style="margin-bottom: 10px;">
<a :href="getlinkforgetpwd" style="color:gray;">{{$t('reg.forgetpassword')}}</a>
</div>
<!--Prova URL : {{env('PROVA_PAOLO')}}-->
<form>
<div class="q-gutter-xs">
<q-input
v-model="signin.username"
rounded outlined dense
@blur="$v.signin.username.$touch"
:error="$v.signin.username.$error"
:error-message="`${errorMsg('username', $v.signin.username)}`"
:label="$t('reg.username_login')">
<!--<q-card class="flex flex-center">-->
<!--&lt;!&ndash;<q-btn v-if="$myconfig.socialLogin.facebook" :loading="loading" class="q-mb-md q-mr-md" rounded icon="fab fa-facebook-f" size="sm" color="blue-10" text-color="white" @click="facebook" :label="$t('components.authentication.login.facebook')"/>&ndash;&gt;-->
<!--&lt;!&ndash;-->
<!--<q-btn v-if="$myconfig.socialLogin.facebook" class="q-mb-md q-mr-md" rounded icon="fab fa-facebook-f" size="sm" color="blue-10" text-color="white" @click="facebook" :label="$t('components.authentication.login.facebook')"/>-->
<!--<q-btn v-if="$myconfig.socialLogin.google" class="q-mb-md q-mr-md" rounded icon="fab fa-google" size="sm" color="deep-orange-14" text-color="white" @click="google" :label="$t('components.authentication.login.google')"/>-->
<!--&ndash;&gt;-->
<!--</q-card>-->
<div align="center">
<q-btn rounded size="md" color="primary" @click="submit"
:disable="$v.$error || iswaitingforRes">{{$t('login.enter')}}
</q-btn>
</div>
<div v-if="static_data.functionality.ENABLE_REGISTRATION" align="center" style="margin-top:10px;">
<q-btn flat rounded size="md" color="primary" to="/signup">{{$t('reg.submit')}}
</q-btn>
</div>
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signin.password"
type="password"
rounded outlined dense
@blur="$v.signin.password.$touch"
:error="$v.signin.password.$error"
:error-message="`${errorMsg('password', $v.signin.password)}`"
:label="$t('reg.password')">
<template v-slot:prepend>
<q-icon name="vpn_key"/>
</template>
</q-input>
<div class="text-center" style="margin-bottom: 10px;">
<a :href="getlinkforgetpwd" style="color:gray;">{{$t('reg.forgetpassword')}}</a>
</div>
<!--<q-card class="flex flex-center">-->
<!--&lt;!&ndash;<q-btn v-if="$myconfig.socialLogin.facebook" :loading="loading" class="q-mb-md q-mr-md" rounded icon="fab fa-facebook-f" size="sm" color="blue-10" text-color="white" @click="facebook" :label="$t('components.authentication.login.facebook')"/>&ndash;&gt;-->
<!--&lt;!&ndash;-->
<!--<q-btn v-if="$myconfig.socialLogin.facebook" class="q-mb-md q-mr-md" rounded icon="fab fa-facebook-f" size="sm" color="blue-10" text-color="white" @click="facebook" :label="$t('components.authentication.login.facebook')"/>-->
<!--<q-btn v-if="$myconfig.socialLogin.google" class="q-mb-md q-mr-md" rounded icon="fab fa-google" size="sm" color="deep-orange-14" text-color="white" @click="google" :label="$t('components.authentication.login.google')"/>-->
<!--&ndash;&gt;-->
<!--</q-card>-->
<div align="center">
<q-btn rounded size="md" color="primary" @click="submit"
:disable="$v.$error || iswaitingforRes">{{$t('login.enter')}}
</q-btn>
</div>
<div v-if="static_data.functionality.ENABLE_REGISTRATION" align="center" style="margin-top:10px;">
<q-btn flat rounded size="md" color="primary" to="/signup">{{$t('reg.submit')}}
</q-btn>
</div>
</div>
</form>
</div>
</div>
</form>
</div>
</template>
<script lang="ts" src="./CSignIn.ts">
</script>
<style lang="scss" scoped>
@import './CSignIn.scss';
@import './CSignIn.scss';
</style>

View File

@@ -21,6 +21,7 @@ import { Logo } from '../../components/logo'
})
export default class CSignUp extends Vue {
@Prop({ required: false, default: false }) public adult: boolean
public $v
public $q
public $t: any
@@ -35,14 +36,23 @@ export default class CSignUp extends Vue {
surname: process.env.TEST_SURNAME || '',
password: process.env.TEST_PASSWORD || '',
repeatPassword: process.env.TEST_PASSWORD || '',
terms: !process.env.PROD
terms: !process.env.PROD,
}
public created() {
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() {
}
get allowSubmit() {

View File

@@ -1,144 +1,169 @@
<template>
<div>
<div class="text-center">
<p>
<logo></logo>
</p>
</div>
<!--Prova URL : {{env('PROVA_PAOLO')}}-->
<div class="q-gutter-xs">
<q-input
v-model="signup.email"
rounded outlined
@blur="$v.signup.email.$touch"
:error="$v.signup.email.$error"
:error-message="errorMsg('email', $v.signup.email)"
bottom-slots
debounce="1000"
:label="$t('reg.email')">
<template v-slot:prepend>
<q-icon name="email"/>
</template>
</q-input>
<q-input
v-model="signup.username"
rounded outlined
@blur="$v.signup.username.$touch"
:error="$v.signup.username.$error"
bottom-slots
debounce="1000"
:error-message="errorMsg('username', $v.signup.username)"
:label="$t('reg.username')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signup.name"
rounded outlined
@blur="$v.signup.name.$touch"
:error="$v.signup.name.$error"
bottom-slots
debounce="1000"
:error-message="errorMsg('name', $v.signup.name)"
:label="$t('reg.name')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signup.surname"
rounded outlined
@blur="$v.signup.surname.$touch"
:error="$v.signup.surname.$error"
bottom-slots
debounce="1000"
:error-message="errorMsg('surname', $v.signup.surname)"
:label="$t('reg.surname')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signup.password"
type="password"
rounded outlined
@blur="$v.signup.password.$touch"
:error="$v.signup.password.$error"
:error-message="`${errorMsg('password', $v.signup.password)}`"
bottom-slots
:label="$t('reg.password')">
<template v-slot:prepend>
<q-icon name="vpn_key"/>
</template>
</q-input>
<q-input
v-model="signup.repeatPassword"
type="password"
rounded outlined
@blur="$v.signup.repeatPassword.$touch"
:error="$v.signup.repeatPassword.$error"
:error-message="`${errorMsg('repeatpassword', $v.signup.repeatPassword)}`"
bottom-slots
:label="$t('reg.repeatPassword')">
<template v-slot:prepend>
<q-icon name="vpn_key"/>
</template>
</q-input>
<!--:hint="$t('reg.tips.repeatpassword')"-->
<q-checkbox
v-model="signup.terms"
color="secondary"
@blur="$v.signup.terms.$touch"
:error="$v.signup.terms.$error"
:error-message="`${errorMsg('terms', $v.signup.terms)}`"
:label="$t('reg.terms')">
</q-checkbox>
<br>
<div class="wrapper">
<q-btn rounded size="lg" color="positive" @click="submitOk" :disabled='!allowSubmit'>
{{$t('reg.submit')}}
</q-btn>
</div>
</div>
<!--
<div align="center">
<q-btn rounded size="lg" color="primary" @click="submitOk" :disable="">{{$t('reg.submit')}}
</q-btn>
</div>
-->
<div>
<div class="text-center">
<p>
<logo></logo>
</p>
</div>
<!--Prova URL : {{env('PROVA_PAOLO')}}-->
<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
v-model="signup.email"
rounded outlined
@blur="$v.signup.email.$touch"
:error="$v.signup.email.$error"
:error-message="errorMsg('email', $v.signup.email)"
bottom-slots
debounce="1000"
:label="$t('reg.email')">
<template v-slot:prepend>
<q-icon name="email"/>
</template>
</q-input>
<q-input
v-model="signup.username"
rounded outlined
@blur="$v.signup.username.$touch"
:error="$v.signup.username.$error"
bottom-slots
debounce="1000"
:error-message="errorMsg('username', $v.signup.username)"
:label="$t('reg.username')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signup.name"
rounded outlined
@blur="$v.signup.name.$touch"
:error="$v.signup.name.$error"
bottom-slots
debounce="1000"
:error-message="errorMsg('name', $v.signup.name)"
:label="$t('reg.name')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signup.surname"
rounded outlined
@blur="$v.signup.surname.$touch"
:error="$v.signup.surname.$error"
bottom-slots
debounce="1000"
:error-message="errorMsg('surname', $v.signup.surname)"
:label="$t('reg.surname')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signup.password"
type="password"
rounded outlined
@blur="$v.signup.password.$touch"
:error="$v.signup.password.$error"
:error-message="`${errorMsg('password', $v.signup.password)}`"
bottom-slots
:label="$t('reg.password')">
<template v-slot:prepend>
<q-icon name="vpn_key"/>
</template>
</q-input>
<q-input
v-model="signup.repeatPassword"
type="password"
rounded outlined
@blur="$v.signup.repeatPassword.$touch"
:error="$v.signup.repeatPassword.$error"
:error-message="`${errorMsg('repeatpassword', $v.signup.repeatPassword)}`"
bottom-slots
:label="$t('reg.repeatPassword')">
<template v-slot:prepend>
<q-icon name="vpn_key"/>
</template>
</q-input>
<!--:hint="$t('reg.tips.repeatpassword')"-->
<q-checkbox
v-model="signup.terms"
color="secondary"
@blur="$v.signup.terms.$touch"
:error="$v.signup.terms.$error"
:error-message="`${errorMsg('terms', $v.signup.terms)}`"
:label="$t('reg.terms')">
</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>
<div class="wrapper">
<q-btn rounded size="lg" color="positive" @click="submitOk" :disabled='!allowSubmit'>
{{$t('reg.submit')}}
</q-btn>
</div>
</div>
<!--
<div align="center">
<q-btn rounded size="lg" color="primary" @click="submitOk" :disable="">{{$t('reg.submit')}}
</q-btn>
</div>
-->
</div>
</template>
<script lang="ts" src="./CSignUp.ts">
</script>
<style lang="scss" scoped>
@import './CSignUp.scss';
@import './CSignUp.scss';
</style>

View File

@@ -308,7 +308,7 @@ export default class Header extends Vue {
}
get getappname() {
return tools.getappname(this, tools.isMobile())
return tools.getsuffisso() + tools.getappname(this, tools.isMobile())
}
public toggleanimation() {
@@ -368,4 +368,13 @@ export default class Header extends Vue {
this.rightDrawerOpen = false
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>
<div>
<q-header reveal elevated class="bg-primary">
<q-header reveal elevated :class="getClassColorHeader">
<q-toolbar
color="primary"
:glossy="$q.theme === 'mat'"
@@ -155,8 +155,8 @@
<!--<span class="text-white background-red" v-else> {{$t('reg.non_verificato')}} </span>-->
<div v-if="isLogged" id="user-actions" class="text-center">
<q-btn round color="primary" icon="person"></q-btn>
<q-btn round color="warning" icon="lock"></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="secondary" icon="exit_to_app" @click='logoutHandler'></q-btn>
</div>

View File

@@ -35,3 +35,4 @@ export * from './CGoogleMap'
export * from './COpenStreetMap'
export * from './CTitleBanner'
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 { tools } from '../store/Modules/tools'
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 { CalendarStore } from '@store'
import MixinMetaTags from '@src/mixins/mixin-metatags'
@@ -16,6 +16,10 @@ export default class MixinBase extends MixinMetaTags {
return this
}
public showNotif(msg) {
tools.showNotif(this.$q, this.$t(msg))
}
get toolsext() {
return toolsext
}
@@ -32,57 +36,95 @@ export default class MixinBase extends MixinMetaTags {
return tools
}
public getValDb(keystr, serv, def?) {
const ris = GlobalStore.getters.getValueSettingsByKey(keystr, serv)
if (ris === '')
if (def !== undefined)
return 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)
if (ris === '')
if (def !== undefined)
return def
else
return ''
else
return ''
else
return ris
return ris
}
}
public async setValDb(key, value, type, serv: boolean) {
public async setValDb(key, value, type, serv: boolean, table?, subkey?) {
console.log('setValDb', key, value, serv)
GlobalStore.mutations.setValueSettingsByKey({ key, value, serv })
console.log('setValDb', key, value, serv, table, subkey)
let mydatatosave = null
if (table === 'users') {
const myid = UserStore.state.my._id
let myrec = GlobalStore.getters.getrecSettingsByKey(key, serv)
if (myrec === undefined) {
myrec = {
idapp: process.env.APP_ID,
key,
type
let myfield = {}
if (key === 'profile') {
UserStore.state.my.profile[subkey] = value
} else {
UserStore.state.my[key] = value
}
myrec.serv = serv
if (myrec.type === tools.FieldType.date)
myrec.value_date = value
else if (myrec.type === tools.FieldType.number)
myrec.value_num = value
else if (myrec.type === tools.FieldType.boolean)
myrec.value_bool = value
else
myrec.value_str = value
myrec = await tools.createNewRecord(this, 'settings', myrec).then((myrecris) => {
// console.log('myrec')
let recsett = null
if (serv)
recsett = GlobalStore.state.serv_settings
// 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 })
let myrec = GlobalStore.getters.getrecSettingsByKey(key, serv)
if (myrec === undefined) {
myrec = {
idapp: process.env.APP_ID,
key,
type
}
myrec.serv = serv
if (myrec.type === tools.FieldType.date)
myrec.value_date = value
else if (myrec.type === tools.FieldType.number)
myrec.value_num = value
else if (myrec.type === tools.FieldType.boolean)
myrec.value_bool = value
else
recsett = GlobalStore.state.settings
myrec.value_str = value
recsett.push(myrecris)
return recsett.find((rec) => rec.key === key)
})
}
console.log('myrec', myrec)
myrec = await tools.createNewRecord(this, 'settings', myrec).then((myrecris) => {
// console.log('myrec')
let recsett = null
if (serv)
recsett = GlobalStore.state.serv_settings
else
recsett = GlobalStore.state.settings
const mydatatosave = {
id: myrec._id,
table: 'settings',
fieldsvalue: myrec
recsett.push(myrecris)
return recsett.find((rec) => rec.key === key)
})
}
console.log('myrec', myrec)
mydatatosave = {
id: myrec._id,
table: 'settings',
fieldsvalue: myrec
}
}
console.log('mydatatosave', mydatatosave)

View File

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

View File

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

View File

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

View File

@@ -105,11 +105,14 @@ const msgglobal = {
options: 'Opzioni',
},
reg: {
aportador_solidario: 'Chi ti ha Invitato',
page_title: 'Registrazione',
incorso: 'Registrazione in corso...',
richiesto: 'Campo Richiesto',
email: 'Email',
cell: 'Telefono',
email_paypal: 'Email Paypal',
username_telegram: 'Username Telegram',
img: 'Immagine',
date_reg: 'Data Reg.',
perm: 'Permessi',
@@ -120,6 +123,7 @@ const msgglobal = {
password: 'Password',
repeatPassword: 'Ripeti password',
terms: "Accetto i termini e le condizioni",
onlyadult: "Confermo di essere Maggiorenne",
submit: "Registrati",
title_verif_reg: "Verifica Registrazione",
verificato: "Verificato",
@@ -130,7 +134,8 @@ const msgglobal = {
email: 'inserire una email valida',
errore_generico: 'Si prega di compilare correttamente i campi',
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',
char: 'caratteri',
terms: 'Devi accettare le condizioni, per continuare.',
@@ -469,11 +474,14 @@ const msgglobal = {
options: 'Opciones',
},
reg: {
aportador_solidario: 'Aportador Solidario',
page_title: 'Registro',
incorso: 'Registro en curso...',
richiesto: 'Campo requerido',
email: 'Email',
cell: 'Móvil',
email_paypal: 'Email Paypal',
username_telegram: 'Usuario Telegram',
img: 'File image',
date_reg: 'Fecha Reg.',
perm: 'Permisos',
@@ -484,6 +492,7 @@ const msgglobal = {
password: 'contraseña',
repeatPassword: 'Repetir contraseña',
terms: "Acepto los términos y condiciones",
onlyadult: "Confirmo que soy mayor de edad",
submit: "Registrarse",
title_verif_reg: "Verifica registro",
verificato: "Verificado",
@@ -494,7 +503,7 @@ const msgglobal = {
email: 'Debe ser una email válida.',
errore_generico: 'Por favor, rellene los campos correctamente',
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',
char: 'caracteres',
terms: 'Debes aceptar las condiciones, para continuar..',
@@ -824,10 +833,13 @@ const msgglobal = {
options: 'Options',
},
reg: {
aportador_solidario: 'Contributeur de solidarité',
incorso: 'Inscription en cours...',
richiesto: 'Champ obligatoire',
email: 'Email',
cell: 'Téléphone',
email_paypal: 'Email Paypal',
username_telegram: 'Nom d\'utilisateur du Telegram',
img: 'Fichier image',
date_reg: 'Date Inscript.',
perm: 'Autorisations',
@@ -838,6 +850,7 @@ const msgglobal = {
password: 'mot de passe',
repeatPassword: 'Répéter le mot de passe',
terms: "J'accepte les termes et conditions",
onlyadult: "Je confirme que je suis majeur",
submit: "S'inscrire",
title_verif_reg: "Vérifier l'inscription",
verificato: "Vérifié",
@@ -848,7 +861,7 @@ const msgglobal = {
email: 'Ce doit être un email valide.',
errore_generico: 'S\'il vous plaît remplir les champs correctement',
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',
char: 'caractères',
terms: 'Vous devez accepter les conditions, pour continuer..',
@@ -1178,10 +1191,13 @@ const msgglobal = {
options: 'Options',
},
reg: {
aportador_solidario: 'Solidarity Contributor',
incorso: 'Registration please wait...',
richiesto: 'Field Required',
email: 'Email',
cell: 'Phone',
email_paypal: 'Email Paypal',
username_telegram: 'Username Telegram',
img: 'File Image',
date_reg: 'Reg. Date',
perm: 'Permissions',
@@ -1192,6 +1208,7 @@ const msgglobal = {
password: 'Password',
repeatPassword: 'Repeat password',
terms: "I agree with the terms and conditions",
onlyadult: "I confirm that I'm at least 18 years old",
submit: "Submit",
title_verif_reg: "Verify Registration",
verificato: "Verified",
@@ -1202,7 +1219,7 @@ const msgglobal = {
email: 'must be a valid email',
errore_generico: 'Please review fields again',
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',
char: 'characters long',
terms: 'You need to agree with the terms & conditions.',
@@ -1531,11 +1548,14 @@ const msgglobal = {
options: 'Options',
},
reg: {
aportador_solidario: 'Solidarity Contributor',
page_title: 'Registration',
incorso: 'Registration please wait...',
richiesto: 'Field Required',
email: 'Email',
cell: 'Phone',
email_paypal: 'Email Paypal',
username_telegram: 'Username Telegram',
img: 'File Image',
date_reg: 'Reg. Date',
perm: 'Permissions',
@@ -1546,6 +1566,7 @@ const msgglobal = {
password: 'Password',
repeatPassword: 'Repeat password',
terms: "I agree with the terms and conditions",
onlyadult: "I confirm that I'm at least 18 years old",
submit: "Submit",
title_verif_reg: "Verify Registration",
verificato: "Verified",
@@ -1556,7 +1577,7 @@ const msgglobal = {
email: 'must be a valid email',
errore_generico: 'Please review fields again',
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',
char: 'characters long',
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] : []
}
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
})

View File

@@ -1,5 +1,5 @@
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 { storeBuilder } from './Store/Store'
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
const state: IUserState = {
my: DefaultUser,
@@ -203,6 +212,9 @@ namespace Getters {
namespace Mutations {
function authUser(mystate: IUserState, data: IUserFields) {
mystate.my = { ...data }
if (!mystate.my.profile) {
mystate.my.profile = DefaultProfile
}
mystate.isAdmin = tools.isBitActive(mystate.my.perm, shared_consts.Permissions.Admin.value)
mystate.isManager = tools.isBitActive(mystate.my.perm, shared_consts.Permissions.Manager.value)
@@ -231,6 +243,29 @@ namespace Mutations {
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[]) {
// console.log('setusersList', usersList)
mystate.usersList = [...usersList]
@@ -325,6 +360,7 @@ namespace Mutations {
}
export const mutations = {
updateLocalStorage: b.commit(updateLocalStorage),
authUser: b.commit(authUser),
setpassword: b.commit(setpassword),
setemail: b.commit(setemail),
@@ -609,24 +645,7 @@ namespace Actions {
Mutations.mutations.authUser(myuser)
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))
Mutations.mutations.updateLocalStorage(myuser)
}
}
@@ -739,6 +758,7 @@ namespace Actions {
const token = localStorage.getItem(tools.localStorage.token)
if (token) {
const expirationDateStr = localStorage.getItem(tools.localStorage.expirationDate)
const expirationDate = new Date(String(expirationDateStr))
const now = tools.getDateNow()
@@ -753,7 +773,7 @@ namespace Actions {
GlobalStore.state.wasAlreadySubOnDb = localStorage.getItem(tools.localStorage.wasAlreadySubOnDb) === 'true'
console.log('************* autologin _id', _id)
// console.log('************* autologin _id', _id)
UserStore.mutations.setAuth(token)

View File

@@ -378,7 +378,9 @@ export const fieldsTable = {
AddCol({ name: 'name', label_trans: 'reg.name' }),
AddCol({ name: 'surname', label_trans: 'reg.surname' }),
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: 'date_reg', label_trans: 'reg.date_reg', fieldtype: tools.FieldType.date }),
// AddCol({ name: 'idapp', label_trans: 'reg.idapp', fieldtype: tools.FieldType.string }),

View File

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

View File

@@ -11,5 +11,17 @@ import { CSignUp } from '../../../components/CSignUp'
export default class Signup extends Vue {
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>
<q-page padding class="signup">
<CSignUp>
<CSignUp :adult="adult">
</CSignUp>
</q-page>