Email Verificata !
This commit is contained in:
@@ -5,7 +5,7 @@ Vue.use(Vuex);
|
||||
|
||||
export const cfg = new Vue({
|
||||
state:{
|
||||
lang: 'it'
|
||||
lang: 'en'
|
||||
},
|
||||
data: {
|
||||
cost: {
|
||||
|
||||
@@ -105,7 +105,6 @@
|
||||
import * as types from '../../../store/mutation-types'
|
||||
|
||||
import {Errori_MongoDb} from '../../../store/modules/user'
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
|
||||
@@ -136,9 +135,6 @@
|
||||
'getUserServer',
|
||||
'getServerCode',
|
||||
]),
|
||||
user() {
|
||||
//return this.getUserServer();
|
||||
},
|
||||
env() {
|
||||
return env
|
||||
},
|
||||
@@ -239,8 +235,6 @@
|
||||
return
|
||||
}
|
||||
|
||||
var mythis = this;
|
||||
|
||||
console.log(this.form);
|
||||
this.signup(this.form)
|
||||
.then((riscode) => {
|
||||
|
||||
84
src/components/views/login/vreg.vue
Normal file
84
src/components/views/login/vreg.vue
Normal file
@@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<div class="mypanel">
|
||||
<q-alert color="primary q-title" style="text-align: center;">
|
||||
{{ $t('reg.title_verif_reg')}}
|
||||
</q-alert>
|
||||
<br>
|
||||
|
||||
<transition
|
||||
enter-active-class="animated flipInX"
|
||||
leave-active-class="animated flipOutX"
|
||||
appear
|
||||
>
|
||||
<q-alert
|
||||
v-if="giaverificato"
|
||||
type="warning"
|
||||
>
|
||||
{{ risultato}}
|
||||
</q-alert>
|
||||
<q-alert
|
||||
v-if="verificatook"
|
||||
type="positive"
|
||||
>
|
||||
{{ risultato}}
|
||||
</q-alert>
|
||||
</transition>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {mapActions} from 'vuex'
|
||||
import * as types from '../../../store/mutation-types'
|
||||
import {Errori_MongoDb} from '../../../store/modules/user'
|
||||
|
||||
import {serv_constants} from '../../../store/modules/serv_constants';
|
||||
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
risultato : '',
|
||||
riscode: 0
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.load();
|
||||
},
|
||||
computed:{
|
||||
giaverificato: function() {
|
||||
return this.riscode !== serv_constants.RIS_CODE_EMAIL_VERIFIED
|
||||
},
|
||||
verificatook: function() {
|
||||
return this.riscode === serv_constants.RIS_CODE_EMAIL_VERIFIED
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapActions("user", {
|
||||
verifreg: types.USER_VREG,
|
||||
}),
|
||||
load: function () {
|
||||
this.verifreg(this.$route.query).then((ris) => {
|
||||
this.riscode = ris.code;
|
||||
this.risultato = ris.msg;
|
||||
console.log("RIS = ");
|
||||
console.log(ris);
|
||||
}).catch((err) => {
|
||||
console.log("ERR = " + err);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.mypanel {
|
||||
padding:10px;
|
||||
margin: 10px;
|
||||
|
||||
}
|
||||
</style>
|
||||
@@ -13,6 +13,7 @@ const messages = {
|
||||
repeatPassword: 'Ripeti password',
|
||||
terms: "Accetti i termini e le condizioni?",
|
||||
submit: "Registrati",
|
||||
title_verif_reg: "Verifica Registrazione",
|
||||
err: {
|
||||
required: 'è richiesto',
|
||||
email: 'dev\'essere una email valida',
|
||||
@@ -41,6 +42,7 @@ const messages = {
|
||||
repeatPassword: 'Repeat password',
|
||||
terms: "Do you agree with the terms & conditions?",
|
||||
submit: "Submit",
|
||||
title_verif_reg: "Verify Registration",
|
||||
err: {
|
||||
required: 'is required',
|
||||
email: 'must be a valid email',
|
||||
|
||||
5
src/plugins/axios.js
Normal file
5
src/plugins/axios.js
Normal file
@@ -0,0 +1,5 @@
|
||||
import axios from 'axios'
|
||||
|
||||
export default ({ Vue }) => {
|
||||
Vue.prototype.$axios = axios
|
||||
}
|
||||
@@ -4,14 +4,14 @@ import messages from 'src/i18n';
|
||||
|
||||
export default ({ app, store, Vue }) => {
|
||||
Vue.use(VueI18n);
|
||||
Vue.config.lang = 'it';
|
||||
Vue.config.lang = process.env.LANG_DEFAULT;
|
||||
|
||||
console.log("PLUGINS INIT....");
|
||||
|
||||
// Set i18n instance on app
|
||||
app.i18n = new VueI18n({
|
||||
locale: 'it',
|
||||
fallbackLocale: 'it',
|
||||
locale: process.env.LANG_DEFAULT,
|
||||
fallbackLocale: process.env.LANG_DEFAULT,
|
||||
messages
|
||||
})
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ const routes = [
|
||||
{ path: '/', component: () => import('pages/Index.vue') },
|
||||
{ path: '/signup', component: load('views/login/signup'), meta: { name: 'Registration' } },
|
||||
{ path: '/login', component: load('views/login/login'), meta: { name: 'Login' } },
|
||||
{ path: '/vreg', component: load('views/login/vreg'), meta: { name: 'Verify Reg' } },
|
||||
|
||||
];
|
||||
|
||||
|
||||
4
src/store/modules/serv_constants.js
Normal file
4
src/store/modules/serv_constants.js
Normal file
@@ -0,0 +1,4 @@
|
||||
export const serv_constants = {
|
||||
RIS_CODE_EMAIL_ALREADY_VERIFIED: -20,
|
||||
RIS_CODE_EMAIL_VERIFIED: 1,
|
||||
};
|
||||
@@ -6,6 +6,13 @@ Vue.use(Vuex);
|
||||
import * as types from '../mutation-types'
|
||||
//import tools from '../../../tools/tools'
|
||||
|
||||
function getlang(){
|
||||
if (state.user.lang !== "")
|
||||
return state.user.lang;
|
||||
else
|
||||
return process.env.LANG_DEFAULT
|
||||
}
|
||||
|
||||
export const Errori_MongoDb = {
|
||||
CALLING: 10,
|
||||
OK: 20,
|
||||
@@ -19,24 +26,29 @@ export const state = {
|
||||
_id: '',
|
||||
email: '',
|
||||
username: null,
|
||||
idapp: process.env.APP_ID,
|
||||
password: '',
|
||||
lang: '',
|
||||
ripetipassword: '',
|
||||
dateofbirth: '',
|
||||
|
||||
tokens: [{
|
||||
access: '',
|
||||
token: ''
|
||||
}]
|
||||
}],
|
||||
|
||||
verified_email: false,
|
||||
},
|
||||
userServer: null,
|
||||
servercode: 0,
|
||||
};
|
||||
|
||||
function sendRequest(url, method, mydata) {
|
||||
console.log("LANG " + getlang());
|
||||
const options = {
|
||||
method: method,
|
||||
//mode: 'no-cors',
|
||||
headers: new Headers({'content-type': 'application/json', 'x-auth': ''}),
|
||||
headers: new Headers({'content-type': 'application/json', 'x-auth': '', 'accept-language': getlang()}),
|
||||
cache: "no-cache",
|
||||
body: JSON.stringify(mydata),
|
||||
};
|
||||
@@ -55,6 +67,7 @@ export const getters = {
|
||||
getDateOfBirth: state => state.user.dateofbirth,
|
||||
getUserServer: state => state.user.userServer,
|
||||
getServerCode: state => state.servercode,
|
||||
getLang: state => state.user.lang,
|
||||
};
|
||||
|
||||
|
||||
@@ -71,6 +84,9 @@ export const mutations = {
|
||||
[types.USER_EMAIL]: (state, payload) => {
|
||||
state.user.email = payload;
|
||||
},
|
||||
[types.USER_LANG]: (state, payload) => {
|
||||
state.user.lang = payload;
|
||||
},
|
||||
[types.USER_DATEOFBIRTH]: (state, payload) => {
|
||||
state.user.dateOfBirth = payload;
|
||||
},
|
||||
@@ -104,19 +120,63 @@ export const actions = {
|
||||
[types.USER_EMAIL]: ({commit}, payload) => {
|
||||
commit(types.USER_EMAIL, payload)
|
||||
},
|
||||
[types.USER_LANG]: ({commit}, payload) => {
|
||||
commit(types.USER_LANG, payload)
|
||||
},
|
||||
[types.USER_DATEOFBIRTH]: ({commit}, payload) => {
|
||||
commit(types.USER_DATEOFBIRTH, payload)
|
||||
},
|
||||
|
||||
[types.USER_VREG]: ({commit}, paramquery) => {
|
||||
var call = process.env.MONGODB_HOST + '/vreg';
|
||||
console.log("CALL " + call);
|
||||
|
||||
let params = {
|
||||
keyappid: process.env.PAO_APP_ID,
|
||||
idapp: process.env.APP_ID,
|
||||
idlink: paramquery.idlink,
|
||||
};
|
||||
console.log(params);
|
||||
|
||||
commit('setServerCode', Errori_MongoDb.CALLING);
|
||||
|
||||
var myres;
|
||||
|
||||
return sendRequest(call, "POST", params)
|
||||
.then((res) => {
|
||||
//console.log("RITORNO 1 ");
|
||||
console.log(res);
|
||||
//console.log(res.status);
|
||||
myres = res;
|
||||
if (myres.status === 200) {
|
||||
return myres.json();
|
||||
}
|
||||
commit('setServerCode', Errori_MongoDb.ERR_GENERICO);
|
||||
return {code: Errori_MongoDb.ERR_GENERICO, msg: 'Errore: ' + myres.status};
|
||||
|
||||
})
|
||||
.then((body) => {
|
||||
//console.log("RITORNO 2 ");
|
||||
//commit('setServerCode', myres);
|
||||
return {code: body.code, msg: body.msg};
|
||||
}).catch((err) => {
|
||||
console.log("ERROR: " + err);
|
||||
commit('setServerCode', Errori_MongoDb.ERR_GENERICO);
|
||||
return {code: Errori_MongoDb.ERR_GENERICO, msg: 'Errore'};
|
||||
});
|
||||
},
|
||||
|
||||
[types.USER_SIGNUP]: ({commit}, authData) => {
|
||||
var call = process.env.MONGODB_HOST + '/users';
|
||||
console.log("CALL " + call);
|
||||
|
||||
let params = {
|
||||
keyappid: process.env.PAO_APP_ID,
|
||||
lang: state.user.lang,
|
||||
email: authData.email,
|
||||
password: authData.password,
|
||||
username: authData.username,
|
||||
idapp: process.env.APP_ID,
|
||||
};
|
||||
|
||||
console.log(params);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
export const SET_VALUE = 'SET_VALUE';
|
||||
export const SET_DEFFERED_PROMPT = 'defprompt';
|
||||
export const SET_LOGIN_PAGE = 'setloginpage';
|
||||
@@ -11,11 +12,11 @@ export const SET_FORM_SIGNUP = 'formsignup';
|
||||
export const USER_REC = 'user_rec';
|
||||
export const USER_USERNAME = 'username';
|
||||
export const USER_EMAIL = 'email';
|
||||
export const USER_LANG = 'lang';
|
||||
export const USER_PASSWORD = 'password';
|
||||
export const USER_DATEOFBIRTH = 'dateofbirth';
|
||||
|
||||
export const USER_SIGNUP = 'signup';
|
||||
|
||||
|
||||
export const USER_VREG = 'vreg';
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user