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",
"baseUrl": "http://localhost:8080",
"env": {
"adminusername": "manager",
"adminusername": "superuser",
"adminpassword": "l3tm3in"
}
}

View File

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

View File

@@ -2,29 +2,29 @@
import decode from "jwt-decode";
import initialize from "./initialize";
export function processLogin(response) {
export function processLogin(authResponse, loggedInWithKnownPassword) {
return new Promise(async function(resolve, reject) {
try {
//check there is a response of some kind
if (!response) {
if (!authResponse) {
window.$gz.store.commit("logItem", "auth::processLogin -> no response");
return reject();
}
//is there an error?
if (response.error) {
return reject(response.error);
if (authResponse.error) {
return reject(authResponse.error);
}
//is token present?
if (!response.data || !response.data.token) {
if (!authResponse.data || !authResponse.data.token) {
window.$gz.store.commit(
"logItem",
"auth::processLogin -> response contains no data"
);
return reject();
}
const token = decode(response.data.token);
const token = decode(authResponse.data.token);
if (!token || !token.iss) {
window.$gz.store.commit(
@@ -46,15 +46,19 @@ export function processLogin(response) {
window.$gz.store.commit("logout");
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
window.$gz.store.commit("login", {
apiToken: response.data.token,
apiToken: authResponse.data.token,
authenticated: true,
userId: Number(token.id),
userName: response.data.name,
roles: response.data.roles,
userType: response.data.usertype,
dlt: response.data.dlt
userName: authResponse.data.name,
roles: authResponse.data.roles,
userType: authResponse.data.usertype,
dlt: authResponse.data.dlt
});
//log the login
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 sub = [];
@@ -777,8 +777,18 @@ export default function initialize() {
await window.$gz.translation.cacheTranslations(
window.$gz.translation.coreKeys
);
await initNavPanal();
initNavPanel();
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();
} catch (err) {
reject(err);

View File

@@ -44,7 +44,8 @@ export default new Vuex.Store({
logArray: [],
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,
darkMode: false
darkMode: false,
knownPassword: false
},
mutations: {
setLastClientVersion(state, data) {
@@ -80,6 +81,7 @@ export default new Vuex.Store({
state.locale.currencyName = "USD";
state.locale.hour12 = true;
state.globalSettings = {};
state.knownPassword = false;
},
addNavItem(state, data) {
state.navItems.push(data);
@@ -144,6 +146,9 @@ export default new Vuex.Store({
},
setDarkMode(state, data) {
state.darkMode = data;
},
setKnownPassword(state, data) {
state.knownPassword = data;
}
},
actions: {}

View File

@@ -4,7 +4,63 @@
<v-form ref="form">
<v-row>
<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-form>
</v-col>
@@ -60,6 +116,7 @@ export default {
selectLists: {
translations: []
},
currentStep: 1,
obj: {},
formState: {
ready: false,
@@ -100,6 +157,9 @@ export default {
}
},
methods: {
completeStep() {
return 1;
},
translation() {
return window.$gz.translation;
},

View File

@@ -106,6 +106,15 @@ export default {
readOnly: false
});
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 => {
vm.formState.ready = true;

View File

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