Files
leadchat/app/javascript/v3/views/auth/password/Edit.vue
Sivin Varghese dafedddc1a feat: Remove Foundation in favor of Tailwind (#8984)
* feat: Remove foundation

* chore: Minor fix

* Minor fix

* Update _forms.scss

* chore: More changes

* chore: Minor fix

* chore: Clean up

* fix: font-weight

* chore: More changes

* chore: Setting page

* chore: Editor fix

* chore: Reports page

* chore: More changes

* chore: Minor changes

* chore: More fixes

* chore: More changes

* chore: More changes

* chore: More changes

* chore: Minor fix

* chore: More changes

* chore: More changes

* chore: More changes

* chore: More changes

* chore: Clean up

* chore: Minor fix

* chore: Clean ups

* chore: Rename basic file

* chore: Remove unused files

* chore: Fix expanded input

* Fix campaign rendering

* chore: Clean up

* chore: More changes

* chore: Remove unused files

* fix: Overflow issue

* chore: Minor fix

* chore: Clean up

* chore: Minor fix

* chore: Remove unused files

* chore: Minor fix

* chore: Minor fix

* fix: autoprefixer start/end value has mixed support

* chore: Minor fix

* chore: Remove unused files

* chore: Minor fix

* chore: Minor fix

* chore: Minor fix

* Add responsive design to label settings

* fix inbox view

* chore: Minor fix

* w-60% to w-2/3

* chore: Fix team

* chore: Fix button

* w-[34%] to w-1/3

* chore: Fix border

* Add support mobile views in team page

* chore: fix snackbar

* chore: clean up

* chore: Clean up

* fix: loading state alignment

* fix: alert styles

* chore: Minor fix

* fix: spacing for agent bot row

* fix: layout

* fix: layout for SLA

* fix: checkbox

* fix: SLA checkbox spacing

* Update inbox settings pages

* fix macros listing page layout

* fix canned responses

* chore: Fix bot page

* chore: fix automation page

* chore: fix agents page

* chore: fix canned response editor

* chore: Fix settings table

* chore: fix settings layout

* chore: Minor fix

* fix: canned response table layou

* fix: layout for table header for webhooks

* fix: webhook row layout

* fix: dashboard app modal layout

* fix: add title to canned response truncated shortcode

* fix: dashboard apps row layuot

* fix: layouts hooks

* fix: body color

* fix: delete action color in portal locales

* fix: text color for campagin title

* fix: success button color

---------

Co-authored-by: Pranav <pranav@chatwoot.com>
Co-authored-by: Vishnu Narayanan <iamwishnu@gmail.com>
Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
2024-02-28 13:56:28 +05:30

133 lines
3.7 KiB
Vue

<template>
<div
class="flex flex-col bg-woot-25 min-h-full w-full py-12 sm:px-6 lg:px-8 justify-center dark:bg-slate-900"
>
<form
class="sm:mx-auto sm:w-full sm:max-w-lg bg-white dark:bg-slate-800 p-11 shadow sm:shadow-lg sm:rounded-lg"
@submit.prevent="submitForm"
>
<h1
class="mb-1 text-left text-2xl font-medium tracking-tight text-slate-900 dark:text-white"
>
{{ $t('SET_NEW_PASSWORD.TITLE') }}
</h1>
<div class="space-y-5">
<form-input
v-model.trim="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"
/>
<form-input
v-model.trim="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"
/>
<submit-button
:disabled="
$v.credentials.password.$invalid ||
$v.credentials.confirmPassword.$invalid ||
newPasswordAPI.showLoading
"
:button-text="$t('SET_NEW_PASSWORD.SUBMIT')"
:loading="newPasswordAPI.showLoading"
/>
</div>
</form>
</div>
</template>
<script>
import { required, minLength } from 'vuelidate/lib/validators';
import FormInput from '../../../components/Form/Input.vue';
import SubmitButton from '../../../components/Button/SubmitButton.vue';
import { DEFAULT_REDIRECT_URL } from 'dashboard/constants/globals';
import { setNewPassword } from '../../../api/auth';
export default {
components: {
FormInput,
SubmitButton,
},
props: {
resetPasswordToken: { type: String, default: '' },
redirectUrl: { type: String, default: '' },
config: { type: String, default: '' },
},
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: {
showAlert(message) {
// Reset loading, current selected agent
this.newPasswordAPI.showLoading = false;
bus.$emit('newToastMessage', 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.showAlert(
error?.message || this.$t('SET_NEW_PASSWORD.API.ERROR_MESSAGE')
);
});
},
},
};
</script>