fix fields login

This commit is contained in:
Paolo Arena
2019-03-13 13:40:17 +01:00
parent 67748ce94f
commit 9376b397d7
21 changed files with 207 additions and 203 deletions

View File

@@ -39,3 +39,8 @@
transform: translateX(1600px); transform: translateX(1600px);
} }
} }
.my-notif-class{
font-weight: bold;
}

View File

@@ -17,6 +17,6 @@
</template> </template>
<script lang="ts" src="./App.ts"> <script lang="ts" src="./App.ts">
</script> </script>
<style lang="scss" scoped> <style lang="scss">
@import './App.scss'; @import './App.scss';
</style> </style>

View File

@@ -12,10 +12,8 @@ export async function askConfirm($q: any, mytitle, mytext, ok, cancel) {
title: mytitle title: mytitle
}).then((ris) => { }).then((ris) => {
return true return true
// this.$q.notify('Agreed!')
}).catch(() => { }).catch(() => {
return false return false
// this.$q.notify('Disagreed...')
}) })
} catch (e) { } catch (e) {
return false return false

View File

@@ -99,7 +99,7 @@ export default class Header extends Vue {
set lang(lang) { set lang(lang) {
console.log('set lang(' + this.$i18n.locale) console.log('set lang(' + this.$i18n.locale)
this.$i18n.locale = this.snakeToCamel(lang) this.$i18n.locale = this.snakeToCamel(lang)
// this.$q.notify('IMPOSTA LANG= ' + this.$i18n.locale) // tools.showNotif(this.$q, 'IMPOSTA LANG= ' + this.$i18n.locale)
// console.log('IMPOSTA LANG= ' + this.$i18n.locale) // console.log('IMPOSTA LANG= ' + this.$i18n.locale)
UserStore.mutations.setlang(this.$i18n.locale) UserStore.mutations.setlang(this.$i18n.locale)
@@ -123,13 +123,6 @@ export default class Header extends Vue {
public changeconn(value: string, oldValue: string) { public changeconn(value: string, oldValue: string) {
this.strConn = value this.strConn = value
// this.$q.notify({
// color : 'primary',
// icon: 'wifi',
// message: "CAMBIATOO! " + value
// })
} }
@Watch('conndata_changed', { immediate: true, deep: true }) @Watch('conndata_changed', { immediate: true, deep: true })
@@ -162,10 +155,9 @@ export default class Header extends Vue {
const color = (value === 'online') ? 'positive' : 'warning' const color = (value === 'online') ? 'positive' : 'warning'
if (oldValue !== undefined) { if (oldValue !== undefined) {
this.$q.notify({ tools.showNotif(this.$q, this.$t('connection') + ` ${value}`, {
color, color,
icon: 'wifi', icon: 'wifi'
message: this.$t('connection') + ` ${value}`
}) })
} }
@@ -235,7 +227,7 @@ export default class Header extends Vue {
console.log('this.$q.i18n=', this.$q.i18n, 'this.$q.getLocale()=', this.$q.lang.isoName) console.log('this.$q.i18n=', this.$q.i18n, 'this.$q.getLocale()=', this.$q.lang.isoName)
const my = this.getLangAtt() const my = this.getLangAtt()
this.$q.notify('prima: ' + String(my)) tools.showNotif(this.$q, 'prima: ' + String(my))
let mylang = tools.getItemLS(tools.localStorage.lang) let mylang = tools.getItemLS(tools.localStorage.lang)
if (mylang === '') { if (mylang === '') {
@@ -266,7 +258,6 @@ export default class Header extends Vue {
this.setLangAtt(mylang) this.setLangAtt(mylang)
this.setshortlang(mylang) this.setshortlang(mylang)
// this.$q.notify('Dopo: ' + String(this.getLangAtt()))
} }

View File

@@ -3,6 +3,7 @@ import { Component, Watch } from 'vue-property-decorator'
import { SingleCat } from '../SingleCat' import { SingleCat } from '../SingleCat'
import { ICategory } from '@src/model' import { ICategory } from '@src/model'
import { tools } from "@src/store/Modules/tools"
@Component({ @Component({
@@ -176,13 +177,10 @@ export default class Category extends Vue {
const seldel = [...this.selectedSecond] const seldel = [...this.selectedSecond]
if (this.deleteCategory(this.selectedSecond)) { if (this.deleteCategory(this.selectedSecond)) {
this.$q.notify({ tools.showNotif(this.$q, `Deleted ` + (seldel.length.toString()) + ' item', {
color: 'primary', color: 'primary',
icon: 'delete', icon: 'delete',
message: `Deleted ` + (seldel.length.toString()) + ' item'
}) })
} }
} }

View File

@@ -3,6 +3,7 @@ import { Component, Watch } from 'vue-property-decorator'
import { ICategory } from '@src/model' import { ICategory } from '@src/model'
import globalroutines from "@src/globalroutines" import globalroutines from "@src/globalroutines"
import { tools } from "@src/store/Modules/tools"
@Component({ @Component({
}) })
@@ -172,10 +173,9 @@ export default class Tabledata extends Vue {
const seldel = [...this.selectedSecond] const seldel = [...this.selectedSecond]
if (this.deleteCategory(this.selectedSecond)) { if (this.deleteCategory(this.selectedSecond)) {
this.$q.notify({ tools.showNotif(this.$q, `Deleted ` + (seldel.length.toString()) + ' item', {
color: 'primary', color: 'primary',
icon: 'delete', icon: 'delete'
message: `Deleted ` + (seldel.length.toString()) + ' item'
}) })

View File

@@ -450,7 +450,6 @@ export default class SingleTodo extends Vue {
this.updateicon() this.updateicon()
} }
// this.$q.notify('setPriority: ' + elem)
} }
public async askConfirmDelete() { public async askConfirmDelete() {

View File

@@ -321,13 +321,13 @@ export default class Todo extends Vue {
} }
if (UserStore.state.userId === undefined) { if (UserStore.state.userId === undefined) {
this.$q.notify(this.$t('todo.usernotdefined')) tools.showNotif(this.$q, this.$t('todo.usernotdefined'))
return return
} }
if (!this.isRegistered()) { if (!this.isRegistered()) {
// Not logged // Not logged
this.$q.notify(this.$t('user.notregistered')) tools.showNotif(this.$q, this.$t('user.notregistered'))
return return
} }
@@ -341,7 +341,7 @@ export default class Todo extends Vue {
console.log('data', data) console.log('data', data)
if (data !== null) { if (data !== null) {
this.$q.notify(data) tools.showNotif(this.$q, data)
} }
// empty the field // empty the field

View File

@@ -4,6 +4,7 @@ import { UserStore } from '@modules'
import { GlobalStore } from '@modules' import { GlobalStore } from '@modules'
import Vue from 'vue' import Vue from 'vue'
import { Component, Prop } from 'vue-property-decorator' import { Component, Prop } from 'vue-property-decorator'
import { tools } from "@src/store/Modules/tools"
const namespace: string = 'GlobalModule' const namespace: string = 'GlobalModule'
@@ -46,7 +47,7 @@ export default class Drawer extends Vue {
this.$router.replace('/') this.$router.replace('/')
}, 1000) }, 1000)
this.$q.notify(this.$t('logout.uscito')) tools.showNotif(this.$q, this.$t('logout.uscito'), {icon: 'exit_to_app'})
}) })
} }
} }

View File

@@ -8,15 +8,15 @@
<div v-for="item in parent.routes"> <div v-for="item in parent.routes">
<div v-if="item.routes2"> <div v-if="item.routes2">
<q-expansion-item <q-expansion-item
:header-inset-level="1" :header-inset-level="0.5"
:content-inset-level="1" :content-inset-level="0.5"
:label="$t(item.name)" :label="$t(item.name)"
:icon="item.materialIcon" :icon="item.materialIcon"
class="titleSubMenu" class="titleSubMenu"
> >
<q-expansion-item v-for="(child2, index) in item.routes2" :to="child2.route" :key="index" <q-expansion-item v-for="(child2, index) in item.routes2" :to="child2.route" :key="index"
:header-inset-level="1.1" :header-inset-level="0.5"
:duration="300" :duration="300"
expand-icon="map" expand-icon="map"
:active="child2.label === 'Outbox'" :active="child2.label === 'Outbox'"

View File

@@ -286,19 +286,29 @@ body.mobile .landing:before {
padding-left: 20px; padding-left: 20px;
} }
.clgutter{
margin-top:20px;
padding: 10px;
}
@media (max-width: 718px) { @media (max-width: 718px) {
.landing__hero { .landing__hero {
text-align: center text-align: center
} }
.landing__header { .landing__header {
height: 9vh height: 7vh
}
.clgutter{
margin-top: 0px;
padding: 0px;
} }
.landing__hero .text-h1 { .landing__hero .text-h1 {
font-size: 3rem; font-size: 3rem;
line-height: 3.05rem; line-height: 3.05rem;
margin-bottom: 24px margin-bottom: 24px
} }
.landing > section.padding { .landing > section.padding {
padding: 40px 16px padding: 40px 16px
//padding-bottom: 90px //padding-bottom: 90px

View File

@@ -4,7 +4,8 @@ import { GlobalStore, UserStore } from '@store'
import { Logo } from '../../components/logo' import { Logo } from '../../components/logo'
import VueScrollReveal from 'vue-scroll-reveal'; import VueScrollReveal from 'vue-scroll-reveal'
import { tools } from '@src/store/Modules/tools'
Vue.use(VueScrollReveal, { Vue.use(VueScrollReveal, {
class: 'v-scroll-reveal', // A CSS class applied to elements with the v-scroll-reveal directive; useful for animation overrides. class: 'v-scroll-reveal', // A CSS class applied to elements with the v-scroll-reveal directive; useful for animation overrides.
@@ -17,21 +18,21 @@ Vue.use(VueScrollReveal, {
z: 0 z: 0
} }
// mobile: true // mobile: true
}); })
@Component({ @Component({
components: { Logo } components: { Logo }
}) })
export default class Home extends Vue { export default class Home extends Vue {
text: string = '' public text: string = ''
visibile: boolean = false public visibile: boolean = false
cardvisible: string = 'hidden' public cardvisible: string = 'hidden'
displaycard: string = 'block' public displaycard: string = 'block'
svgclass: string = 'svgclass' public svgclass: string = 'svgclass'
$t: any public $t: any
firstClassSection: string = 'landing fade homep-cover-img animate-fade homep-cover-img-1' public firstClassSection: string = 'landing fade homep-cover-img animate-fade homep-cover-img-1'
public $q public $q
polling public polling
constructor() { constructor() {
super() super()
@@ -39,9 +40,9 @@ export default class Home extends Vue {
this.initprompt() this.initprompt()
} }
mounted() { public mounted() {
let primo = true let primo = true
let mytime = 10000 const mytime = 10000
this.polling = setInterval(() => { this.polling = setInterval(() => {
this.firstClassSection = 'landing fade homep-cover-img ' + (primo ? 'homep-cover-img-2' : 'homep-cover-img-1') this.firstClassSection = 'landing fade homep-cover-img ' + (primo ? 'homep-cover-img-2' : 'homep-cover-img-1')
@@ -52,11 +53,11 @@ export default class Home extends Vue {
}, mytime) }, mytime)
} }
beforeDestroy() { public beforeDestroy() {
console.log('beforeDestroy') console.log('beforeDestroy')
clearInterval(this.polling) clearInterval(this.polling)
} }
created() { public created() {
GlobalStore.actions.prova() GlobalStore.actions.prova()
} }
@@ -69,8 +70,7 @@ export default class Home extends Vue {
return process.env.TELEGRAM_SUPPORT return process.env.TELEGRAM_SUPPORT
} }
public meta() {
meta() {
return { return {
keywords: { name: 'keywords', content: 'Quasar website' }, keywords: { name: 'keywords', content: 'Quasar website' },
// meta tags // meta tags
@@ -78,13 +78,12 @@ export default class Home extends Vue {
mykey: { name: 'mykey', content: 'Key 1' }, mykey: { name: 'mykey', content: 'Key 1' },
description: { name: 'description', content: 'Page 1' }, description: { name: 'description', content: 'Page 1' },
keywords: { name: 'keywords', content: 'Quasar website' }, keywords: { name: 'keywords', content: 'Quasar website' },
equiv: { 'http-equiv': 'Content-Type', content: 'text/html; charset=UTF-8' } equiv: { 'http-equiv': 'Content-Type', 'content': 'text/html; charset=UTF-8' }
} }
} }
} }
public mystilecard() {
mystilecard() {
return { return {
visibility: this.cardvisible, visibility: this.cardvisible,
display: this.displaycard display: this.displaycard
@@ -95,27 +94,18 @@ export default class Home extends Vue {
return GlobalStore.state.conta return GlobalStore.state.conta
} }
getenv(myvar) { public getenv(myvar) {
return process.env[myvar] return process.env[myvar]
} }
set conta(valore) { set conta(valore) {
GlobalStore.actions.setConta(valore) GlobalStore.actions.setConta(valore)
let my = this.$q.lang.isoName const my = this.$q.lang.isoName
this.showNotif(String(my)) tools.showNotif(this.$q, String(my))
} }
showNotif(message: string, color = 'primary', icon = '') { public initprompt() {
this.$q.notify({ window.addEventListener('beforeinstallprompt', function(event) {
color,
icon,
message
})
}
initprompt() {
window.addEventListener('beforeinstallprompt', function (event) {
// console.log('******************************** beforeinstallprompt fired') // console.log('******************************** beforeinstallprompt fired')
event.preventDefault() event.preventDefault()
// console.log('§§§§§§§§§§§§§§§§§§§§ IMPOSTA DEFERRED PROMPT !!!!!!!!!!!!!!!!! ') // console.log('§§§§§§§§§§§§§§§§§§§§ IMPOSTA DEFERRED PROMPT !!!!!!!!!!!!!!!!! ')
@@ -125,27 +115,27 @@ export default class Home extends Vue {
} }
get isInCostruction () { get isInCostruction() {
return process.env.IN_CONSTRUCTION === '1' return process.env.IN_CONSTRUCTION === '1'
} }
getPermission() { public getPermission() {
return Notification.permission return Notification.permission
} }
NotServiceWorker() { public NotServiceWorker() {
return (!('serviceWorker' in navigator)) return (!('serviceWorker' in navigator))
} }
PagLogin () { public PagLogin() {
this.$router.replace('/signin') this.$router.replace('/signin')
} }
PagReg () { public PagReg() {
this.$router.replace('/signup') this.$router.replace('/signup')
} }
displayConfirmNotification() { public displayConfirmNotification() {
let options = null let options = null
if ('serviceWorker' in navigator) { if ('serviceWorker' in navigator) {
options = { options = {
@@ -166,21 +156,21 @@ export default class Home extends Vue {
if ('serviceWorker' in navigator) { if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready navigator.serviceWorker.ready
.then(function (swreg) { .then(function(swreg) {
swreg.showNotification('Successfully subscribed!', options) swreg.showNotification('Successfully subscribed!', options)
}) })
} }
} }
} }
urlBase64ToUint8Array(base64String) { public urlBase64ToUint8Array(base64String) {
let padding = '='.repeat((4 - base64String.length % 4) % 4) const padding = '='.repeat((4 - base64String.length % 4) % 4)
let base64 = (base64String + padding) const base64 = (base64String + padding)
.replace(/\-/g, '+') .replace(/\-/g, '+')
.replace(/_/g, '/') .replace(/_/g, '/')
let rawData = window.atob(base64) const rawData = window.atob(base64)
let outputArray = new Uint8Array(rawData.length) const outputArray = new Uint8Array(rawData.length)
for (let i = 0; i < rawData.length; ++i) { for (let i = 0; i < rawData.length; ++i) {
outputArray[i] = rawData.charCodeAt(i) outputArray[i] = rawData.charCodeAt(i)
@@ -188,22 +178,21 @@ export default class Home extends Vue {
return outputArray return outputArray
} }
dataURItoBlob(dataURI) { public dataURItoBlob(dataURI) {
let byteString = atob(dataURI.split(',')[1]) const byteString = atob(dataURI.split(',')[1])
let mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0] const mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]
let ab = new ArrayBuffer(byteString.length) const ab = new ArrayBuffer(byteString.length)
let ia = new Uint8Array(ab) const ia = new Uint8Array(ab)
for (let i = 0; i < byteString.length; i++) { for (let i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i) ia[i] = byteString.charCodeAt(i)
} }
let blob = new Blob([ab], { type: mimeString }) const blob = new Blob([ab], { type: mimeString })
return blob return blob
} }
public showNotificationExample() {
showNotificationExample() {
let options = null let options = null
let mythis = this const mythis = this
if ('serviceWorker' in navigator) { if ('serviceWorker' in navigator) {
options = { options = {
body: mythis.$t('notification.subscribed'), body: mythis.$t('notification.subscribed'),
@@ -222,23 +211,21 @@ export default class Home extends Vue {
} }
navigator.serviceWorker.ready navigator.serviceWorker.ready
.then(function (swreg) { .then(function(swreg) {
swreg.showNotification('aaa', options) swreg.showNotification('aaa', options)
}) })
} }
} }
public askfornotification() {
tools.showNotif(this.$q, this.$t('notification.waitingconfirm'), {color: 'positive', icon: 'notifications'})
askfornotification() {
this.showNotif(this.$t('notification.waitingconfirm'), 'positive', 'notifications')
Notification.requestPermission((result) => { Notification.requestPermission((result) => {
console.log('User Choice', result) console.log('User Choice', result)
if (result === 'granted') { if (result === 'granted') {
this.showNotif(this.$t('notification.confirmed'), 'positive', 'notifications') tools.showNotif(this.$q, this.$t('notification.confirmed'), {color: 'positive', icon: 'notifications'})
} else { } else {
this.showNotif(this.$t('notification.denied'), 'negative', 'notifications') tools.showNotif(this.$q, this.$t('notification.denied'), {color: 'negative', icon: 'notifications'})
// displayConfirmNotification(); // displayConfirmNotification();
} }
@@ -246,8 +233,7 @@ export default class Home extends Vue {
} }
public test_fetch() {
test_fetch() {
fetch('https:/httpbin.org/post', { fetch('https:/httpbin.org/post', {
method: 'POST', method: 'POST',
headers: { headers: {
@@ -257,20 +243,22 @@ export default class Home extends Vue {
// mode: 'no-cors', // mode: 'no-cors',
mode: 'cors', mode: 'cors',
body: JSON.stringify({ message: 'Does this work?' }) body: JSON.stringify({ message: 'Does this work?' })
}).then(function (response) { }).then(function(response) {
console.log(response) console.log(response)
if (response) if (response) {
return response.json() return response.json()
else }
else {
return null return null
}).then(function (data) { }
}).then(function(data) {
console.log(data) console.log(data)
}).catch(function (err) { }).catch(function(err) {
console.log(err) console.log(err)
}) })
} }
openCreatePostModal() { public openCreatePostModal() {
console.log('APERTO ! openCreatePostModal') console.log('APERTO ! openCreatePostModal')
this.conta = this.conta + 1 this.conta = this.conta + 1
@@ -287,7 +275,6 @@ export default class Home extends Vue {
} }
/* /*
backgroundSequence() { backgroundSequence() {
window.clearTimeout() window.clearTimeout()

View File

@@ -4,12 +4,12 @@
<section> <section>
<div class="landing__hero"> <div class="landing__hero">
<div class="landing__header"></div> <div class="landing__header"></div>
<div class="landing__hero-content row justify-center q-gutter-xl"> <div class="landing__hero-content row justify-center q-gutter-xs clgutter">
<div class="row"> <div class="row">
<logo></logo> <logo></logo>
</div> </div>
<div class="flex justify-end"> <div class="flex justify-end">
<div class="q-gutter-sm testo-banda"> <div class="q-gutter-xs testo-banda clgutter">
<div class="text-h1 shadow-max">FreePlanet</div> <div class="text-h1 shadow-max">FreePlanet</div>
<div class="text-subtitle1 shadow text-italic q-pl-sm">{{$t('msg.sottoTitoloApp')}} <div class="text-subtitle1 shadow text-italic q-pl-sm">{{$t('msg.sottoTitoloApp')}}
</div> </div>

View File

@@ -166,7 +166,7 @@ const messages = {
forgetpassword: "Password dimenticata?", forgetpassword: "Password dimenticata?",
err: { err: {
required: 'è richiesto', required: 'è richiesto',
email: 'dev\'essere 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 carattere minuscolo, 1 maiuscola e 1 cifra', complexity: 'deve contenere almeno 1 carattere minuscolo, 1 maiuscola e 1 cifra',

View File

@@ -4,6 +4,12 @@ import { Todos, UserStore } from '@store'
import globalroutines from './../../globalroutines/index' import globalroutines from './../../globalroutines/index'
import { costanti } from './costanti' import { costanti } from './costanti'
export interface INotify {
color?: string | 'primary'
textColor?: string
icon?: string | ''
}
export const tools = { export const tools = {
EMPTY: 0, EMPTY: 0,
CALLING: 10, CALLING: 10,
@@ -431,7 +437,22 @@ export const tools = {
}) })
}) })
} }
},
showNotif(q: any, msg, data?: INotify | null ) {
let myicon = data ? data.icon : 'ion-add'
if (!myicon)
myicon = 'ion-add'
let mycolor = data ? data.color : 'primary'
if (!mycolor)
mycolor = 'primary'
q.notify({
message: msg,
icon: myicon,
classes: 'my-notif-class',
color: mycolor,
timeout: 3000
})
} }
} }

View File

@@ -57,6 +57,7 @@
import { email, required } from "vuelidate/lib/validators" import { email, required } from "vuelidate/lib/validators"
import { UserStore } from "../../store/Modules"; import { UserStore } from "../../store/Modules";
import { IUserState } from "../../model"; import { IUserState } from "../../model";
import { tools } from "../../store/Modules/tools";
export default class RequestResetPwd extends Vue{ export default class RequestResetPwd extends Vue{
emailsent = false emailsent = false
form: IUserState = { form: IUserState = {
@@ -78,15 +79,11 @@
// } // }
// }, // },
showNotif(msg: any) {
this.$q.notify(msg)
}
submit() { submit() {
this.$v.form.$touch() this.$v.form.$touch()
if (this.$v.form.$error) { if (this.$v.form.$error) {
this.showNotif(this.$t('reg.err.errore_generico')) tools.showNotif(this.$q, this.$t('reg.err.errore_generico'))
return return
} }

View File

@@ -1,12 +1,11 @@
import { GlobalStore, UserStore } from '@store'
import Vue from 'vue' import Vue from 'vue'
import { Component, Prop, Watch } from 'vue-property-decorator' import { Component, Prop, Watch } from 'vue-property-decorator'
import { GlobalStore, UserStore } from '@store'
import { tools } from '../../../store/Modules/tools'
import { serv_constants } from '../../../store/Modules/serv_constants' import { serv_constants } from '../../../store/Modules/serv_constants'
import { tools } from '../../../store/Modules/tools'
import { ISigninOptions, IUserState } from 'model' import { ISigninOptions, IUserState } from 'model'
import { validations, TSignin } from './signin-validate' import { TSignin, validations } from './signin-validate'
import { validationMixin } from 'vuelidate' import { validationMixin } from 'vuelidate'
@@ -18,31 +17,29 @@ import globalroutines from '../../../globalroutines/index'
// import {Loading, QSpinnerFacebook, QSpinnerGears} from 'quasar' // import {Loading, QSpinnerFacebook, QSpinnerGears} from 'quasar'
@Component({ @Component({
mixins: [validationMixin], mixins: [validationMixin],
validations: validations, validations,
components: { Logo } components: { Logo }
}) })
export default class Signin extends Vue { export default class Signin extends Vue {
public $v public $v
public $q public $q
loading: boolean public loading: boolean
$t: any public $t: any
public iswaitingforRes: boolean = false public iswaitingforRes: boolean = false
public signin: ISigninOptions = { public signin: ISigninOptions = {
username: process.env.TEST_USERNAME || '', username: process.env.TEST_USERNAME || '',
password: process.env.TEST_PASSWORD password: process.env.TEST_PASSWORD || ''
} }
public created() {
created() {
this.$v.$reset() this.$v.$reset()
if (UserStore.state.resStatus === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) { if (UserStore.state.resStatus === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) {
this.showNotif(this.$t('fetch.error_doppiologin')) tools.showNotif(this.$q, this.$t('fetch.error_doppiologin'))
} }
// this.$myconfig.socialLogin.facebook = true // this.$myconfig.socialLogin.facebook = true
@@ -53,9 +50,6 @@ export default class Signin extends Vue {
return process.env return process.env
} }
showNotif(msg: any) {
this.$q.notify(msg)
}
public getlinkforgetpwd() { public getlinkforgetpwd() {
return '/requestresetpwd' return '/requestresetpwd'
@@ -63,47 +57,47 @@ export default class Signin extends Vue {
public errorMsg(cosa: string, item: any) { public errorMsg(cosa: string, item: any) {
try { try {
if (!item.$error) return '' if (!item.$error) { return '' }
if (item.$params.email && !item.email) return this.$t('reg.err.email') if (item.$params.email && !item.email) { return this.$t('reg.err.email') }
if (!item.required) return this.$t('reg.err.required') if (!item.required) { return this.$t('reg.err.required') }
if (!item.minLength) return this.$t('reg.err.atleast') + ` ${item.$params.minLength.min} ` + this.$t('reg.err.char') if (!item.minLength) { return this.$t('reg.err.atleast') + ` ${item.$params.minLength.min} ` + this.$t('reg.err.char') }
if (!item.maxLength) return this.$t('reg.err.notmore') + ` ${item.$params.maxLength.max} ` + this.$t('reg.err.char') if (!item.maxLength) { return this.$t('reg.err.notmore') + ` ${item.$params.maxLength.max} ` + this.$t('reg.err.char') }
return '' return ''
} catch (error) { } catch (error) {
// console.log("ERR : " + error); // console.log("ERR : " + error);
} }
} }
checkErrors(riscode) { public checkErrors(riscode) {
// console.log('checkErrors: ', riscode) // console.log('checkErrors: ', riscode)
try { try {
if (riscode === tools.OK) { if (riscode === tools.OK) {
this.showNotif({ type: 'positive', message: this.$t('login.completato') }) tools.showNotif(this.$q, this.$t('login.completato'), { color: 'positive', icon: 'check'})
this.$router.push('/') this.$router.push('/')
} else if (riscode === serv_constants.RIS_CODE_LOGIN_ERR) { } else if (riscode === serv_constants.RIS_CODE_LOGIN_ERR) {
// Wait N seconds to avoid calling many times... // Wait N seconds to avoid calling many times...
return new Promise(function (resolve, reject) { return new Promise(function(resolve, reject) {
setTimeout(function () { setTimeout(function() {
resolve('anything') resolve('anything')
}, 3000) }, 3000)
}).then(() => { }).then(() => {
setTimeout( () => { setTimeout( () => {
this.$q.loading.hide() this.$q.loading.hide()
}, 200) }, 200)
this.showNotif(this.$t('login.errato')) tools.showNotif(this.$q, this.$t('login.errato'))
this.iswaitingforRes = false this.iswaitingforRes = false
this.$router.push('/signin') this.$router.push('/signin')
}) })
} else if (riscode === tools.ERR_SERVERFETCH) { } else if (riscode === tools.ERR_SERVERFETCH) {
this.showNotif(this.$t('fetch.errore_server')) tools.showNotif(this.$q, this.$t('fetch.errore_server'))
} else if (riscode === tools.ERR_GENERICO) { } else if (riscode === tools.ERR_GENERICO) {
let msg = this.$t('fetch.errore_generico') + UserStore.mutations.getMsgError(riscode) const msg = this.$t('fetch.errore_generico') + UserStore.mutations.getMsgError(riscode)
this.showNotif(msg) tools.showNotif(this.$q, msg)
} else { } else {
this.showNotif('Errore num ' + riscode) tools.showNotif(this.$q, 'Errore num ' + riscode)
} }
if (riscode !== serv_constants.RIS_CODE_LOGIN_ERR) { if (riscode !== serv_constants.RIS_CODE_LOGIN_ERR) {
@@ -118,44 +112,46 @@ export default class Signin extends Vue {
} }
} }
redirect(response) { public redirect(response) {
this.loading = false this.loading = false
window.location.href = response.data.redirect window.location.href = response.data.redirect
} }
error(error) { public error(error) {
this.loading = false this.loading = false
this.$errorHandler(this, error) this.$errorHandler(this, error)
} }
facebook() { public facebook() {
this.loading = true this.loading = true
this.$axios.get('/backend/loginFacebook') this.$axios.get('/backend/loginFacebook')
.then(response => this.redirect(response)) .then((response) => this.redirect(response))
.catch(error => this.error(error)) .catch((error) => this.error(error))
} }
google() { public google() {
} }
submit() { public submit() {
this.$v.signin.$touch() this.$v.signin.$touch()
if (this.$v.signin.$error) { if (this.$v.signin.$error) {
this.showNotif(this.$t('reg.err.errore_generico')) tools.showNotif(this.$q, this.$t('reg.err.errore_generico'))
return return
} }
let msg = this.$t('login.incorso') let msg = this.$t('login.incorso')
if (process.env.DEBUG) if (process.env.DEBUG) {
msg += ' ' + process.env.MONGODB_HOST msg += ' ' + process.env.MONGODB_HOST
}
this.$q.loading.show({ message: msg}) this.$q.loading.show({ message: msg})
// disable Button Login: // disable Button Login:
this.iswaitingforRes = true this.iswaitingforRes = true
if (process.env.DEBUG) if (process.env.DEBUG) {
console.log('this.signin', this.signin) console.log('this.signin', this.signin)
}
UserStore.actions.signin(this.signin) UserStore.actions.signin(this.signin)
.then((riscode) => { .then((riscode) => {
@@ -165,10 +161,12 @@ export default class Signin extends Vue {
} }
return riscode return riscode
}).then((riscode) => { }).then((riscode) => {
if (UserStore.state.lang !== '') if (UserStore.state.lang !== '') {
this.$i18n.locale = UserStore.state.lang // Set Lang this.$i18n.locale = UserStore.state.lang
else } // Set Lang
UserStore.mutations.setlang(this.$i18n.locale) // Set Lang else {
UserStore.mutations.setlang(this.$i18n.locale)
} // Set Lang
// console.log('LANG ORA=', UserStore.state.lang) // console.log('LANG ORA=', UserStore.state.lang)
@@ -178,10 +176,10 @@ export default class Signin extends Vue {
.then((riscode) => { .then((riscode) => {
if (riscode === tools.OK) { if (riscode === tools.OK) {
GlobalStore.actions.createPushSubscription() GlobalStore.actions.createPushSubscription()
.then(rissub => { .then((rissub) => {
}) })
.catch(e => { .catch((e) => {
console.log('ERROR Subscription = ' + e) console.log('ERROR Subscription = ' + e)
}) })
} }
@@ -189,7 +187,7 @@ export default class Signin extends Vue {
this.checkErrors(riscode) this.checkErrors(riscode)
}) })
.catch(error => { .catch((error) => {
console.log('ERROR SIGNIN = ' + error) console.log('ERROR SIGNIN = ' + error)
this.checkErrors(error) this.checkErrors(error)

View File

@@ -9,51 +9,55 @@
<!--Prova URL : {{env('PROVA_PAOLO')}}--> <!--Prova URL : {{env('PROVA_PAOLO')}}-->
<form> <form>
<div class="q-gutter-md">
<q-field
:error="$v.signin.username.$error"
:error-label="`${errorMsg('username', $v.signin.username)}`"
>
<q-input <q-input
v-model="signin.username" v-model="signin.username"
rounded outlined
autocomplete="username" autocomplete="username"
@change="val => { signin.username = val }"
:before="[{icon: 'person', handler () {}}]"
@blur="$v.signin.username.$touch" @blur="$v.signin.username.$touch"
:error="$v.signin.username.$error" :error="$v.signin.username.$error"
:float-label="$t('reg.username_login')"></q-input> :error-message="`${errorMsg('username', $v.signin.username)}`"
</q-field> :label="$t('reg.username_login')">
<q-field
:error="$v.signin.password.$error" <template v-slot:prepend>
:error-label="`${errorMsg('password', $v.signin.password)}`" <q-icon name="person"/>
> </template>
</q-input>
<q-input <q-input
v-model="signin.password" v-model="signin.password"
type="password" type="password"
:before="[{icon: 'vpn_key', handler () {}}]" rounded outlined
@blur="$v.signin.password.$touch" @blur="$v.signin.password.$touch"
:error="$v.signin.password.$error" :error="$v.signin.password.$error"
:float-label="$t('reg.password')"></q-input> :error-message="`${errorMsg('password', $v.signin.password)}`"
</q-field> :label="$t('reg.password')">
<template v-slot:prepend>
<q-icon name="vpn_key"/>
</template>
<div> </q-input>
<a :href="getlinkforgetpwd">{{$t('reg.forgetpassword')}}</a> <div>
</div> <a :href="getlinkforgetpwd">{{$t('reg.forgetpassword')}}</a>
</div>
<br> <br>
<q-card class="flex flex-center"> <q-card class="flex flex-center">
<!--<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')"/>--> <!--<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')"/>-->
<!-- <!--
<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.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')"/> <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')"/>
--> -->
</q-card> </q-card>
<div align="center"> <div align="center">
<q-btn rounded size="lg" color="primary" @click="submit" :disable="$v.$error || iswaitingforRes">{{$t('login.enter')}} <q-btn rounded size="lg" color="primary" @click="submit"
</q-btn> :disable="$v.$error || iswaitingforRes">{{$t('login.enter')}}
</q-btn>
</div>
</div> </div>
</form> </form>
</q-page> </q-page>

View File

@@ -88,11 +88,6 @@ export default class Signup extends Vue {
return process.env return process.env
} }
showNotif(params: any) {
this.$q.notify(params)
}
public errorMsg(cosa: string, item: any) { public errorMsg(cosa: string, item: any) {
try { try {
if (!item.$error) return '' if (!item.$error) return ''
@@ -126,19 +121,19 @@ export default class Signup extends Vue {
checkErrors(riscode: number) { checkErrors(riscode: number) {
console.log('checkErrors', riscode) console.log('checkErrors', riscode)
if (riscode === tools.DUPLICATE_EMAIL_ID) { if (riscode === tools.DUPLICATE_EMAIL_ID) {
this.showNotif(this.$t('reg.err.duplicate_email')) tools.showNotif(this.$q, this.$t('reg.err.duplicate_email'))
} else if (riscode === tools.DUPLICATE_USERNAME_ID) { } else if (riscode === tools.DUPLICATE_USERNAME_ID) {
this.showNotif(this.$t('reg.err.duplicate_username')) tools.showNotif(this.$q, this.$t('reg.err.duplicate_username'))
} else if (riscode === tools.ERR_SERVERFETCH) { } else if (riscode === tools.ERR_SERVERFETCH) {
this.showNotif(this.$t('fetch.errore_server')) tools.showNotif(this.$q, this.$t('fetch.errore_server'))
} else if (riscode === tools.ERR_GENERICO) { } else if (riscode === tools.ERR_GENERICO) {
let msg = this.$t('fetch.errore_generico') + UserStore.mutations.getMsgError(riscode) let msg = this.$t('fetch.errore_generico') + UserStore.mutations.getMsgError(riscode)
this.showNotif(msg) tools.showNotif(this.$q, msg)
} else if (riscode === tools.OK) { } else if (riscode === tools.OK) {
this.$router.push('/signin') this.$router.push('/signin')
this.showNotif({type: 'warning', textColor: 'black', message: this.$t('components.authentication.email_verification.link_sent')}) tools.showNotif(this.$q, this.$t('components.authentication.email_verification.link_sent'), {color: 'warning', textColor: 'black'})
} else { } else {
this.showNotif('Errore num ' + riscode) tools.showNotif(this.$q, 'Errore num ' + riscode)
} }
@@ -152,12 +147,12 @@ export default class Signup extends Vue {
this.duplicate_username = false this.duplicate_username = false
if (!this.signup.terms) { if (!this.signup.terms) {
this.showNotif(this.$t('reg.err.terms')) tools.showNotif(this.$q, this.$t('reg.err.terms'))
return return
} }
if (this.$v.signup.$error) { if (this.$v.signup.$error) {
this.showNotif(this.$t('reg.err.errore_generico')) tools.showNotif(this.$q, this.$t('reg.err.errore_generico'))
return return
} }

View File

@@ -69,6 +69,7 @@
import { required } from "vuelidate/lib/validators" import { required } from "vuelidate/lib/validators"
import { UserStore } from "../../store/Modules"; import { UserStore } from "../../store/Modules";
import { IUserState } from "../../model"; import { IUserState } from "../../model";
import { tools } from "../../store/Modules/tools";
export default class UpdatePassword extends Vue { export default class UpdatePassword extends Vue {
emailsent = false emailsent = false
@@ -96,15 +97,11 @@
// } // }
// }, // },
showNotif(msg: any) {
this.$q.notify(msg)
}
submit() { submit() {
this.$v.form.$touch() this.$v.form.$touch()
if (this.$v.form.$error) { if (this.$v.form.$error) {
this.showNotif(this.$t('reg.err.errore_generico')) tools.showNotif(this.$q, this.$t('reg.err.errore_generico'))
return return
} }

View File

@@ -6,6 +6,7 @@
"jsRules": {}, "jsRules": {},
"rules": { "rules": {
"no-console": false, "no-console": false,
"object-literal-sort-keys": false,
// "no-restricted-syntax": [ // "no-restricted-syntax": [
// "error", // "error",
// { // {
@@ -22,11 +23,13 @@
true, true,
"spaces" "spaces"
], ],
"ordered-imports": false,
"no-duplicate-variable": true, "no-duplicate-variable": true,
"no-eval": true, "no-eval": true,
"no-internal-module": false, "no-internal-module": false,
"no-trailing-whitespace": false, "no-trailing-whitespace": false,
"no-var-keyword": true, "no-var-keyword": true,
"max-line-length": false,
"one-line": [ "one-line": [
true, true,
"check-open-brace", "check-open-brace",