This commit is contained in:
2020-11-19 22:56:26 +00:00
parent 096adaaea6
commit a0ab96fffc
6 changed files with 66 additions and 18 deletions

View File

@@ -48,6 +48,8 @@ User / Contact self password administration and onboarding
todo: User update / save password and login, if try to change login but don't give password it bombs with server error
todo: if authenticated and click reset link sb logged out before reset form opens
todo: Test alt languages in reset ui
todo: suggest loginname be email address
todo: SEEDER
Sample customer contacts need random contact info also entered so it's visible as example

View File

@@ -101,10 +101,6 @@ export default {
//step 2: get it
let transData = null;
console.log(
"translation.js::cachetranslationkeys forcetranslationid=",
forceTranslationId
);
if (forceTranslationId) {
transData = await window.$gz.api.upsert(
`translation/subset/${forceTranslationId}`,

View File

@@ -1033,11 +1033,13 @@ async function fetchTranslatedText(vm) {
await window.$gz.translation.cacheTranslations([
"Vendor",
"User",
"UserSettings",
"Name",
"UserEmployeeNumber",
"NewLogin",
"NewPassword",
"AuthorizationRoles",
"LastLogin",
"UserNotes",
"UserType",
"Active",
@@ -1056,7 +1058,18 @@ async function fetchTranslatedText(vm) {
"UserCustom13",
"UserCustom14",
"UserCustom15",
"UserCustom16"
"UserCustom16",
"CurrencyCode",
"LanguageCode",
"TimeZone",
"UserEmailAddress",
"UserColor",
"Translation",
"DarkMode",
"MapUrlTemplate",
"UserPhone1",
"UserPhone2",
"UserPageAddress"
]);
}

View File

@@ -1066,6 +1066,8 @@ async function initForm(vm) {
//
async function fetchTranslatedText(vm) {
await window.$gz.translation.cacheTranslations([
"User",
"UserSettings",
"Contact",
"Name",
"Customer",
@@ -1073,6 +1075,7 @@ async function fetchTranslatedText(vm) {
"NewLogin",
"NewPassword",
"AuthorizationRoles",
"LastLogin",
"UserNotes",
"UserType",
"Active",

View File

@@ -1,8 +1,18 @@
<template>
<v-form ref="form">
{{ obj }}
<v-row>
{{ formState }}
<v-row v-if="formState.ready">
<v-col cols="12">
<v-text-field
name="username"
id="username"
v-model="obj.loginName"
:readonly="true"
prepend-icon="$ayiUser"
:label="$ay.t('UserLogin')"
data-cy="loginName"
></v-text-field>
</v-col>
<v-col cols="12">
<v-text-field
v-model="obj.newPassword"
@@ -37,10 +47,15 @@
@click:append-outer="reveal = !reveal"
></v-text-field>
</v-col>
<v-col cols="12" md="7" mt-1 mb-5>
<v-btn color="primary" v-on:click="login()" value="LOGIN">
<v-icon>$ayiSignIn</v-icon>
</v-btn>
<v-col cols="12" mt-1 mb-5>
<v-btn
:disabled="!canSave"
color="primary"
value="SUBMIT"
@click="submit()"
data-cy="submit"
>{{ $ay.t("Save") }}</v-btn
>
</v-col>
</v-row>
</v-form>
@@ -56,6 +71,7 @@ export default {
this.obj.loginName = searchParams.get("lg");
this.obj.translationId = parseInt(searchParams.get("tr"));
await initForm(this);
this.formState.ready = true;
},
data() {
return {
@@ -69,9 +85,9 @@ export default {
reveal: true,
formState: {
ready: true,
ready: false,
dirty: false,
valid: true,
valid: false,
readOnly: false,
loading: false,
errorBoxMessage: null,
@@ -80,6 +96,11 @@ export default {
}
};
},
computed: {
canSave: function() {
return this.formState.valid && this.formState.dirty;
}
},
methods: {
translation() {
return window.$gz.translation;
@@ -101,8 +122,8 @@ export default {
try {
let res = await window.$gz.api.upsert(url, {
PasswordResetCode: obj.passwordResetCode,
Password: obj.confirmPassword
PasswordResetCode: vm.obj.passwordResetCode,
Password: vm.obj.confirmPassword
});
if (res.error) {
@@ -110,7 +131,11 @@ export default {
window.$gz.form.setErrorBoxErrors(vm);
} else {
vm.$router.push({
name: "login"
name: "login",
params: {
presetLogin: vm.obj.loginName,
presetPassword: vm.obj.confirmPassword
}
});
}
} catch (error) {
@@ -141,7 +166,8 @@ async function fetchTranslatedText(vm) {
"ConfirmPassword",
"UserLogin",
"ErrorRequiredFieldEmpty",
"ErrorNoMatch"
"ErrorNoMatch",
"Save"
],
vm.obj.translationId
);

View File

@@ -295,6 +295,14 @@ export default {
async created() {
let vm = this;
//debugger;
//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");