Email Verificata !
This commit is contained in:
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