HUGE REFACTOR / CLEANUP
if there is a issue it's probably something in here that was changed
This commit is contained in:
@@ -35,39 +35,6 @@
|
||||
<v-row align="center" justify="center" class="mx-auto mt-sm-12 mb-16">
|
||||
<v-col cols="12" offset-md="4">
|
||||
<form>
|
||||
<!-- <div>
|
||||
<v-icon class="fa-spin">$ayiWrench</v-icon>
|
||||
<v-icon class="fa-pulse">$ayiWrench</v-icon>
|
||||
<v-icon>$ayiBusinessTime</v-icon>
|
||||
<v-icon class="fa-fw">$ayiBusinessTime</v-icon>
|
||||
<v-icon class="fa-border">$ayiBusinessTime</v-icon>
|
||||
<v-icon class="fa-li">$ayiBusinessTime</v-icon>
|
||||
<v-icon class="fa-inverse">$ayiBusinessTime</v-icon>
|
||||
<v-icon class="fa-flip-horizontal">$ayiBusinessTime</v-icon>
|
||||
<v-icon class="fa-flip-vertical">$ayiBusinessTime</v-icon>
|
||||
<v-icon class="fa-flip-both">$ayiBusinessTime</v-icon>
|
||||
<v-icon class="fa-xs">$ayiBusinessTime</v-icon>
|
||||
<v-icon class="fa-6x">$ayiBusinessTime</v-icon>
|
||||
<v-icon class="fa-rotate-90">$ayiBusinessTime</v-icon>
|
||||
<v-icon class="fa-swap-opacity">$ayiBusinessTime</v-icon>
|
||||
<font-awesome-layers class="fa-2x">
|
||||
<font-awesome-icon icon="filter" />
|
||||
<font-awesome-icon
|
||||
style="color: gray;"
|
||||
transform="grow-3 down-2"
|
||||
icon="ban"
|
||||
/>
|
||||
</font-awesome-layers>
|
||||
|
||||
<font-awesome-layers full-width class="fa-4x">
|
||||
<font-awesome-icon icon="bell" />
|
||||
<font-awesome-layers-text
|
||||
class="gray8"
|
||||
transform="down-2 shrink-8"
|
||||
value="Q"
|
||||
/>
|
||||
</font-awesome-layers>
|
||||
</div> -->
|
||||
<v-row>
|
||||
<!-- Customer logo -->
|
||||
<v-col v-if="showCustomSmallLogo()" cols="12">
|
||||
@@ -218,13 +185,9 @@
|
||||
</v-footer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/* xeslint-disable */
|
||||
|
||||
import { processLogin, processLogout } from "../api/authutil";
|
||||
import ayaNovaVersion from "../api/ayanova-version";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -370,25 +333,21 @@ export default {
|
||||
};
|
||||
},
|
||||
async created() {
|
||||
let vm = this;
|
||||
|
||||
const vm = this;
|
||||
window.$gz.eventBus.$emit("menu-change", {
|
||||
isMain: true,
|
||||
icon: "",
|
||||
title: null
|
||||
});
|
||||
|
||||
//reset password redirects here with preset creds
|
||||
//this will help the user identify it and hopefully remember it
|
||||
if (vm.$route.params.presetLogin) {
|
||||
vm.input.username = vm.$route.params.presetLogin;
|
||||
vm.input.password = vm.$route.params.presetPassword;
|
||||
}
|
||||
|
||||
vm.smallLogoUrl = window.$gz.api.logoUrl("small");
|
||||
vm.mediumLogoUrl = window.$gz.api.logoUrl("medium");
|
||||
vm.largeLogoUrl = window.$gz.api.logoUrl("large");
|
||||
|
||||
try {
|
||||
let res = await window.$gz.api.get("notify/hello");
|
||||
if (res.data != null) {
|
||||
@@ -413,12 +372,12 @@ export default {
|
||||
async tfaVerify() {
|
||||
//
|
||||
//send 2fa code to server if ok, then proceed as normal
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
if (vm.pin && vm.pin != "") {
|
||||
vm.pinError = null;
|
||||
|
||||
try {
|
||||
let res = await window.$gz.api.upsert(
|
||||
const res = await window.$gz.api.upsert(
|
||||
"auth/tfa-authenticate",
|
||||
{
|
||||
pin: vm.pin,
|
||||
@@ -432,11 +391,9 @@ export default {
|
||||
// throw new Error(res.error);
|
||||
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
|
||||
}
|
||||
|
||||
await this.step2(res);
|
||||
} catch (error) {
|
||||
//bad PIN?
|
||||
|
||||
if (
|
||||
error.message &&
|
||||
error.message.includes("ErrorUserNotAuthenticated")
|
||||
@@ -471,8 +428,7 @@ export default {
|
||||
}
|
||||
},
|
||||
cancelTfaVerify() {
|
||||
//todo: maybe redirect to login page instead??
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
vm.tt = null;
|
||||
vm.pin = null;
|
||||
vm.errorBadCreds = false;
|
||||
@@ -507,7 +463,6 @@ export default {
|
||||
return true;
|
||||
},
|
||||
showCustomSmallLogo() {
|
||||
//https://vuetifyjs.com/en/features/breakpoints/#breakpoint-service
|
||||
return this.hasMediumLogo && this.$vuetify.breakpoint.smAndDown;
|
||||
},
|
||||
showCustomMediumLogo() {
|
||||
@@ -532,7 +487,7 @@ export default {
|
||||
document.getElementsByName("password")[0].focus();
|
||||
},
|
||||
async login() {
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
|
||||
if (vm.input.username != "" && vm.input.password != "") {
|
||||
vm.errorBadCreds = false;
|
||||
@@ -540,7 +495,7 @@ export default {
|
||||
vm.input.username == "superuser" && vm.input.password == "l3tm3in";
|
||||
|
||||
try {
|
||||
let res = await window.$gz.api.upsert(
|
||||
const res = await window.$gz.api.upsert(
|
||||
"auth",
|
||||
{
|
||||
login: vm.input.username,
|
||||
@@ -548,13 +503,10 @@ export default {
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
if (res.error) {
|
||||
//don't expect this to ever get called but just in case
|
||||
// throw new Error(res.error);
|
||||
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
|
||||
}
|
||||
|
||||
//check for 2fa enabled, if so then need to do one more step before process login can be called
|
||||
if (res.data.tfa) {
|
||||
this.authTwoFactor = res.data.authTwoFactor;
|
||||
@@ -606,9 +558,8 @@ export default {
|
||||
}
|
||||
},
|
||||
async step2(res) {
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
await processLogin(res.data, vm.loggedInWithKnownPassword);
|
||||
|
||||
//check if support and updates has expired and is paid for license and show warning if so
|
||||
if (
|
||||
vm.$store.state.globalSettings.maintenanceExpired &&
|
||||
@@ -625,16 +576,16 @@ export default {
|
||||
})();
|
||||
}
|
||||
|
||||
let toPath = vm.$route.params.topath; //set in app.vue::mounted
|
||||
const toPath = vm.$route.params.topath; //set in app.vue::mounted
|
||||
if (toPath != undefined) {
|
||||
//check if it's an open report link and if so
|
||||
//trigger that to open in a new window and continue on to normal home page
|
||||
if (toPath.startsWith("/viewreport")) {
|
||||
(async function() {
|
||||
//open report links have a query string /viewreport?oid=[objectid]&rid=[reportid]
|
||||
let searchParams = new URLSearchParams(vm.$route.params.search);
|
||||
let objectId = parseInt(searchParams.get("oid"));
|
||||
let reportId = parseInt(searchParams.get("rid"));
|
||||
const searchParams = new URLSearchParams(vm.$route.params.search);
|
||||
const objectId = parseInt(searchParams.get("oid"));
|
||||
const reportId = parseInt(searchParams.get("rid"));
|
||||
await window.$gz.api.renderReport(objectId, reportId); //objectid,reportid
|
||||
})();
|
||||
vm.$router.push(vm.$store.state.homePage);
|
||||
@@ -651,7 +602,6 @@ export default {
|
||||
//very important as this in conjunction with the menu options means
|
||||
//navigation guards work properly by just sending people here
|
||||
next(() => {
|
||||
// auth.logout();
|
||||
processLogout();
|
||||
next();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user