This commit is contained in:
2020-11-19 20:44:36 +00:00
parent 0dbae7d8e4
commit 62cb30853a
3 changed files with 53 additions and 5 deletions

View File

@@ -340,7 +340,7 @@ export default {
} }
let isReset = toPath && toPath.includes("home-reset"); let isReset = toPath && toPath.includes("home-reset");
debugger;
//redirect to login if not authenticated //redirect to login if not authenticated
if (!vm.$store.state.authenticated && !isReset) { if (!vm.$store.state.authenticated && !isReset) {
//If a direct open path was being used but user is not logged in this will catch it //If a direct open path was being used but user is not logged in this will catch it

View File

@@ -79,7 +79,7 @@ export default {
} }
return window.$gz.store.state.translationText[key]; return window.$gz.store.state.translationText[key];
}, },
async cacheTranslations(keys) { async cacheTranslations(keys, forceTranslationId = 0) {
return new Promise(async function fetchTranslationKeysFromServer(resolve) { return new Promise(async function fetchTranslationKeysFromServer(resolve) {
// //
//step 1: build an array of keys that we don't have already //step 1: build an array of keys that we don't have already
@@ -99,7 +99,17 @@ export default {
} }
//step 2: get it //step 2: get it
let transData = await window.$gz.api.upsert("translation/subset", needIt); let transData = null;
if (forceTranslationId != 0) {
debugger;
transData = await window.$gz.api.upsert(
`translation/subset/${forceTranslationId}`,
needIt
);
} else {
transData = await window.$gz.api.upsert("translation/subset", needIt);
}
transData.data.forEach(function commitFetchedTranslationItemToStore( transData.data.forEach(function commitFetchedTranslationItemToStore(
item item
) { ) {

View File

@@ -1,5 +1,7 @@
<template> <template>
<v-form ref="form"> <v-form ref="form">
{{ obj }}
<v-row> <v-row>
<v-col cols="12"> <v-col cols="12">
<v-text-field <v-text-field
@@ -47,14 +49,25 @@
<script> <script>
/* Xeslint-disable */ /* Xeslint-disable */
export default { export default {
async created() {}, async created() {
debugger;
let searchParams = new URLSearchParams(window.location.search);
//home-reset?rc={ResetCode}&tr={EffectiveTranslationId}&lg={loginName}
this.obj.passwordResetCode = searchParams.get("rc");
this.obj.loginName = searchParams.get("lg");
this.obj.translationId = parseInt(searchParams.get("tr"));
await initForm(this);
},
data() { data() {
return { return {
obj: { obj: {
newPassword: null, newPassword: null,
confirmPassword: null, confirmPassword: null,
passwordResetCode: null passwordResetCode: null,
loginName: null,
translationId: 0 //1 //safety valve default to english
}, },
reveal: true, reveal: true,
formState: { formState: {
ready: true, ready: true,
@@ -110,4 +123,29 @@ export default {
} }
} }
}; };
/////////////////////////////////
//
//
async function initForm(vm) {
await fetchTranslatedText(vm);
}
//////////////////////////////////////////////////////////
//
// Ensures UI translated text is available
//
async function fetchTranslatedText(vm) {
debugger;
await window.$gz.translation.cacheTranslations(
[
"NewPassword",
"ConfirmPassword",
"UserLogin",
"ErrorRequiredFieldEmpty",
"ErrorNoMatch"
],
vm.translationId
);
}
</script> </script>