This commit is contained in:
2020-06-10 23:51:25 +00:00
parent 76b8fbd0cb
commit e0359d5de8
8 changed files with 109 additions and 19 deletions

View File

@@ -2,7 +2,7 @@
"pluginsFile": "tests/e2e/plugins/index.js", "pluginsFile": "tests/e2e/plugins/index.js",
"baseUrl": "http://localhost:8080", "baseUrl": "http://localhost:8080",
"env": { "env": {
"adminusername": "manager", "adminusername": "superuser",
"adminpassword": "l3tm3in" "adminpassword": "l3tm3in"
} }
} }

View File

@@ -6,6 +6,8 @@ export default {
async authenticate(login, password) { async authenticate(login, password) {
return new Promise(async function doAuth(resolve, reject) { return new Promise(async function doAuth(resolve, reject) {
try { try {
let loggedInWithKnownPassword =
login == "superuser" && password == "l3tm3in";
let fetchData = await fetch( let fetchData = await fetch(
window.$gz.api.APIUrl("auth"), window.$gz.api.APIUrl("auth"),
window.$gz.api.fetchPostNoAuthOptions({ window.$gz.api.fetchPostNoAuthOptions({
@@ -15,7 +17,7 @@ export default {
); );
fetchData = await window.$gz.api.status(fetchData); fetchData = await window.$gz.api.status(fetchData);
fetchData = await window.$gz.api.extractBody(fetchData); fetchData = await window.$gz.api.extractBody(fetchData);
await processLogin(fetchData); await processLogin(fetchData, loggedInWithKnownPassword);
resolve(); resolve();
} catch (e) { } catch (e) {
reject(e); reject(e);

View File

@@ -2,29 +2,29 @@
import decode from "jwt-decode"; import decode from "jwt-decode";
import initialize from "./initialize"; import initialize from "./initialize";
export function processLogin(response) { export function processLogin(authResponse, loggedInWithKnownPassword) {
return new Promise(async function(resolve, reject) { return new Promise(async function(resolve, reject) {
try { try {
//check there is a response of some kind //check there is a response of some kind
if (!response) { if (!authResponse) {
window.$gz.store.commit("logItem", "auth::processLogin -> no response"); window.$gz.store.commit("logItem", "auth::processLogin -> no response");
return reject(); return reject();
} }
//is there an error? //is there an error?
if (response.error) { if (authResponse.error) {
return reject(response.error); return reject(authResponse.error);
} }
//is token present? //is token present?
if (!response.data || !response.data.token) { if (!authResponse.data || !authResponse.data.token) {
window.$gz.store.commit( window.$gz.store.commit(
"logItem", "logItem",
"auth::processLogin -> response contains no data" "auth::processLogin -> response contains no data"
); );
return reject(); return reject();
} }
const token = decode(response.data.token); const token = decode(authResponse.data.token);
if (!token || !token.iss) { if (!token || !token.iss) {
window.$gz.store.commit( window.$gz.store.commit(
@@ -46,15 +46,19 @@ export function processLogin(response) {
window.$gz.store.commit("logout"); window.$gz.store.commit("logout");
sessionStorage.clear(); //clear all temporary session storage data sessionStorage.clear(); //clear all temporary session storage data
//encourage password changing if a purchased license
if (loggedInWithKnownPassword)
window.$gz.store.commit("setKnownPassword", true);
//Put app relevant items into vuex store so app can use them //Put app relevant items into vuex store so app can use them
window.$gz.store.commit("login", { window.$gz.store.commit("login", {
apiToken: response.data.token, apiToken: authResponse.data.token,
authenticated: true, authenticated: true,
userId: Number(token.id), userId: Number(token.id),
userName: response.data.name, userName: authResponse.data.name,
roles: response.data.roles, roles: authResponse.data.roles,
userType: response.data.usertype, userType: authResponse.data.usertype,
dlt: response.data.dlt dlt: authResponse.data.dlt
}); });
//log the login //log the login
window.$gz.store.commit( window.$gz.store.commit(

View File

@@ -14,7 +14,7 @@ function addNavItem(title, icon, route, navItems, key, testid) {
}); });
} }
function initNavPanal() { function initNavPanel() {
let key = 0; let key = 0;
let sub = []; let sub = [];
@@ -777,8 +777,18 @@ export default function initialize() {
await window.$gz.translation.cacheTranslations( await window.$gz.translation.cacheTranslations(
window.$gz.translation.coreKeys window.$gz.translation.coreKeys
); );
await initNavPanal(); initNavPanel();
await getUserOptions(); await getUserOptions();
//check for known password and a purchased licensed mode
if (
window.$gz.store.state.knownPassword &&
(window.$gz.store.state.globalSettings.licenseStatus == 3 || //ActivePurchased = 3,
window.$gz.store.state.globalSettings.licenseStatus == 4) // ExpiredPurchased = 4
) {
window.$gz.store.commit("setHomePage", "/home-password");
}
resolve(); resolve();
} catch (err) { } catch (err) {
reject(err); reject(err);

View File

@@ -44,7 +44,8 @@ export default new Vuex.Store({
logArray: [], logArray: [],
formSettings: {}, //this is the settings on forms that survive a refresh like grid number of items to show etc formSettings: {}, //this is the settings on forms that survive a refresh like grid number of items to show etc
formCustomTemplate: {}, //this is the custom fields settings for forms, formCustomTemplate: {}, //this is the custom fields settings for forms,
darkMode: false darkMode: false,
knownPassword: false
}, },
mutations: { mutations: {
setLastClientVersion(state, data) { setLastClientVersion(state, data) {
@@ -80,6 +81,7 @@ export default new Vuex.Store({
state.locale.currencyName = "USD"; state.locale.currencyName = "USD";
state.locale.hour12 = true; state.locale.hour12 = true;
state.globalSettings = {}; state.globalSettings = {};
state.knownPassword = false;
}, },
addNavItem(state, data) { addNavItem(state, data) {
state.navItems.push(data); state.navItems.push(data);
@@ -144,6 +146,9 @@ export default new Vuex.Store({
}, },
setDarkMode(state, data) { setDarkMode(state, data) {
state.darkMode = data; state.darkMode = data;
},
setKnownPassword(state, data) {
state.knownPassword = data;
} }
}, },
actions: {} actions: {}

View File

@@ -4,7 +4,63 @@
<v-form ref="form"> <v-form ref="form">
<v-row> <v-row>
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error> <gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
<h1>Launch</h1> <v-col>
<v-stepper v-model="currentStep" vertical>
<v-stepper-step :complete="currentStep > 1" step="1">
Select an app
<small>Summarize if needed</small>
</v-stepper-step>
<v-stepper-content step="1">
<v-card
color="grey lighten-1"
class="mb-12"
height="200px"
></v-card>
<v-btn color="primary" @click="currentStep = 2">Continue</v-btn>
<v-btn text>Cancel</v-btn>
</v-stepper-content>
<v-stepper-step :complete="currentStep > 2" step="2"
>Configure analytics for this app</v-stepper-step
>
<v-stepper-content step="2">
<v-card
color="grey lighten-1"
class="mb-12"
height="200px"
></v-card>
<v-btn color="primary" @click="currentStep = 3">Continue</v-btn>
<v-btn text>Cancel</v-btn>
</v-stepper-content>
<v-stepper-step :complete="currentStep > 3" step="3"
>Select an ad format and name ad unit</v-stepper-step
>
<v-stepper-content step="3">
<v-card
color="grey lighten-1"
class="mb-12"
height="200px"
></v-card>
<v-btn color="primary" @click="currentStep = 4">Continue</v-btn>
<v-btn text>Cancel</v-btn>
</v-stepper-content>
<v-stepper-step step="4">View setup instructions</v-stepper-step>
<v-stepper-content step="4">
<v-card
color="grey lighten-1"
class="mb-12"
height="200px"
></v-card>
<v-btn color="primary" @click="currentStep = 1">Continue</v-btn>
<v-btn text>Cancel</v-btn>
</v-stepper-content>
</v-stepper>
</v-col>
</v-row> </v-row>
</v-form> </v-form>
</v-col> </v-col>
@@ -60,6 +116,7 @@ export default {
selectLists: { selectLists: {
translations: [] translations: []
}, },
currentStep: 1,
obj: {}, obj: {},
formState: { formState: {
ready: false, ready: false,
@@ -100,6 +157,9 @@ export default {
} }
}, },
methods: { methods: {
completeStep() {
return 1;
},
translation() { translation() {
return window.$gz.translation; return window.$gz.translation;
}, },

View File

@@ -106,6 +106,15 @@ export default {
readOnly: false readOnly: false
}); });
window.$gz.eventBus.$on("menu-click", clickHandler); window.$gz.eventBus.$on("menu-click", clickHandler);
//Set known password warning if applicable
if (
window.$gz.store.state.knownPassword &&
(window.$gz.store.state.globalSettings.licenseStatus == 3 || //ActivePurchased = 3,
window.$gz.store.state.globalSettings.licenseStatus == 4) // ExpiredPurchased = 4
) {
this.formState.errorBoxMessage = vm.$ay.t("KnownPasswordWarning");
}
}) })
.catch(err => { .catch(err => {
vm.formState.ready = true; vm.formState.ready = true;

View File

@@ -91,7 +91,7 @@ export default {
data() { data() {
return { return {
input: { input: {
username: "manager", username: "superuser",
password: "l3tm3in" password: "l3tm3in"
}, },
@@ -104,7 +104,7 @@ export default {
trialUsers: [ trialUsers: [
{ {
name: "AyaNova administrator - all", name: "AyaNova administrator - all",
l: "manager", l: "superuser",
p: "l3tm3in" p: "l3tm3in"
}, },
{ {