Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented: support to set reset password email while creating facility (#115). #122

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
"Please contact the administrator.": "Please contact the administrator.",
"Please enter a valid value": "Please enter a valid value",
"Please fill all the required fields": "Please fill all the required fields",
"Please provide a valid email.": "Please provide a valid email.",
"Please provide a password.": "Please provide a password.",
"Primary": "Primary",
"primary store": "primary store",
Expand Down
21 changes: 15 additions & 6 deletions src/views/AddFacilityConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@
{{ translate('Password should be at least 5 characters long, it contains at least one number, one alphabet and one special character.') }}
</ion-note>
</ion-item>
<ion-item>
<ion-label position="floating">{{ translate('Reset password email') }} <ion-text
color="danger">*</ion-text></ion-label>
<ion-input v-model="emailAddress"></ion-input>
</ion-item>
</template>
</template>
</ion-list>
Expand Down Expand Up @@ -152,7 +157,7 @@ import {
starOutline
} from 'ionicons/icons';
import { translate } from "@hotwax/dxp-components";
import { isValidPassword, showToast } from "@/utils";
import { isValidPassword, isValidEmail, showToast } from "@/utils";
import { hasError } from "@/adapter";
import logger from "@/logger";
import { FacilityService } from "@/services/FacilityService";
Expand Down Expand Up @@ -201,6 +206,7 @@ export default defineComponent({
createLoginCreds: false as any,
password: '',
username: '',
emailAddress: '',
selectedProductStores: [] as any,
primaryFacilityGroupId: '' // storing productStoreId initially in this, as at this point we don't fetch shopifyShopId
}
Expand Down Expand Up @@ -252,6 +258,7 @@ export default defineComponent({
"facilityName": this.current.facilityName,
"username": this.username,
"password": this.password,
"emailAddress": this.emailAddress
}

await FacilityService.createFacilityLogin(payload);
Expand All @@ -262,15 +269,17 @@ export default defineComponent({
},
async saveStoreConfig() {
if (this.createLoginCreds) {
if (!this.username) {
showToast(translate('Username is required.'))

if (!this.username || !this.password || !this.emailAddress) {
showToast(translate('Please fill all the required fields'))
return
} else if (await UserService.isUserLoginIdExists(this.username)) {
}
if (this.username && await UserService.isUserLoginIdExists(this.username)) {
showToast(translate('Could not create login user: user with ID already exists.', { userLoginId: this.username }))
return;
}
if (!this.password) {
showToast(translate('Please provide a password.'))
if (!isValidEmail(this.emailAddress)) {
showToast(translate('Please provide a valid email.'))
return
}
}
Expand Down
Loading