Files
assistant-storefront/app/javascript/v3/views/auth/password/Edit.vue
Liang XJ 092fb2e083
Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
Initial commit: Add logistics and order_detail message types
- Add Logistics component with progress tracking
- Add OrderDetail component for order information
- Support data-driven steps and actions
- Add blue color scale to widget SCSS
- Fix node overflow and progress bar rendering issues
- Add English translations for dashboard components

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-26 11:16:56 +08:00

140 lines
3.9 KiB
Vue

<script>
import { useVuelidate } from '@vuelidate/core';
import { required, minLength } from '@vuelidate/validators';
import { useAlert } from 'dashboard/composables';
import FormInput from '../../../components/Form/Input.vue';
import NextButton from 'dashboard/components-next/button/Button.vue';
import { DEFAULT_REDIRECT_URL } from 'dashboard/constants/globals';
import { setNewPassword } from '../../../api/auth';
export default {
components: {
FormInput,
NextButton,
},
props: {
resetPasswordToken: { type: String, default: '' },
},
setup() {
return { v$: useVuelidate() };
},
data() {
return {
// We need to initialize the component with any
// properties that will be used in it
credentials: {
confirmPassword: '',
password: '',
},
newPasswordAPI: {
message: '',
showLoading: false,
},
error: '',
};
},
mounted() {
// If url opened without token
// redirect to login
if (!this.resetPasswordToken) {
window.location = DEFAULT_REDIRECT_URL;
}
},
validations: {
credentials: {
password: {
required,
minLength: minLength(6),
},
confirmPassword: {
required,
minLength: minLength(6),
isEqPassword(value) {
if (value !== this.credentials.password) {
return false;
}
return true;
},
},
},
},
methods: {
showAlertMessage(message) {
// Reset loading, current selected agent
this.newPasswordAPI.showLoading = false;
useAlert(message);
},
submitForm() {
this.newPasswordAPI.showLoading = true;
const credentials = {
confirmPassword: this.credentials.confirmPassword,
password: this.credentials.password,
resetPasswordToken: this.resetPasswordToken,
};
setNewPassword(credentials)
.then(() => {
window.location = DEFAULT_REDIRECT_URL;
})
.catch(error => {
this.showAlertMessage(
error?.message || this.$t('SET_NEW_PASSWORD.API.ERROR_MESSAGE')
);
});
},
},
};
</script>
<template>
<div
class="flex flex-col justify-center w-full min-h-screen py-12 bg-n-brand/5 dark:bg-n-background sm:px-6 lg:px-8"
>
<form
class="bg-white shadow sm:mx-auto sm:w-full sm:max-w-lg dark:bg-n-solid-2 p-11 sm:shadow-lg sm:rounded-lg"
@submit.prevent="submitForm"
>
<h1
class="mb-1 text-2xl font-medium tracking-tight text-left text-n-slate-12"
>
{{ $t('SET_NEW_PASSWORD.TITLE') }}
</h1>
<div class="space-y-5">
<FormInput
v-model="credentials.password"
class="mt-3"
name="password"
type="password"
:has-error="v$.credentials.password.$error"
:error-message="$t('SET_NEW_PASSWORD.PASSWORD.ERROR')"
:placeholder="$t('SET_NEW_PASSWORD.PASSWORD.PLACEHOLDER')"
@blur="v$.credentials.password.$touch"
/>
<FormInput
v-model="credentials.confirmPassword"
class="mt-3"
name="confirm_password"
type="password"
:has-error="v$.credentials.confirmPassword.$error"
:error-message="$t('SET_NEW_PASSWORD.CONFIRM_PASSWORD.ERROR')"
:placeholder="$t('SET_NEW_PASSWORD.CONFIRM_PASSWORD.PLACEHOLDER')"
@blur="v$.credentials.confirmPassword.$touch"
/>
<NextButton
lg
type="submit"
data-testid="submit_button"
class="w-full"
:label="$t('SET_NEW_PASSWORD.SUBMIT')"
:disabled="
v$.credentials.password.$invalid ||
v$.credentials.confirmPassword.$invalid ||
newPasswordAPI.showLoading
"
:is-loading="newPasswordAPI.showLoading"
/>
</div>
</form>
</div>
</template>