-
-
Notifications
You must be signed in to change notification settings - Fork 308
[Remove Vuetify from Studio] 'Forgot password' page #6131
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
base: unstable
Are you sure you want to change the base?
Changes from all commits
5091a3c
35cc159
615933d
cbc030b
6325752
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,82 +1,131 @@ | ||
| <template> | ||
|
|
||
| <MessageLayout | ||
| <StudioMessageLayout | ||
| :header="$tr('forgotPasswordTitle')" | ||
| :text="$tr('forgotPasswordPrompt')" | ||
| > | ||
| <VForm | ||
| <form | ||
| ref="form" | ||
| lazy-validation | ||
| novalidate | ||
| class="forgot-password-form" | ||
| @submit.prevent="submit" | ||
| > | ||
| <Banner | ||
| :text="$tr('forgotPasswordFailed')" | ||
| :value="error" | ||
| <StudioBanner | ||
| v-if="error" | ||
| error | ||
| class="mb-4" | ||
| data-testid="error-banner" | ||
| /> | ||
| <EmailField | ||
| > | ||
| {{ $tr('forgotPasswordFailed') }} | ||
| </StudioBanner> | ||
|
|
||
| <StudioEmailField | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. blocking:
|
||
| v-model="email" | ||
| autofocus | ||
| class="email-field w-100" | ||
| :error-messages="emailErrors" | ||
| @blur="showEmailError" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: The email error hides inconsistently. A mouse click hides it, but tabbing into the field does not. Every keystroke also hides it. |
||
| @input="hideEmailError" | ||
| @click.native="hideEmailError" | ||
| /> | ||
|
|
||
| <KButton | ||
| primary | ||
| class="w-100" | ||
| :text="$tr('submitButton')" | ||
| type="submit" | ||
| /> | ||
| </VForm> | ||
| </MessageLayout> | ||
| </form> | ||
| </StudioMessageLayout> | ||
|
|
||
| </template> | ||
|
|
||
|
|
||
| <script> | ||
|
|
||
| import { mapActions } from 'vuex'; | ||
| import MessageLayout from '../../components/MessageLayout'; | ||
| import EmailField from 'shared/views/form/EmailField'; | ||
| import Banner from 'shared/views/Banner'; | ||
| import StudioMessageLayout from '../../components/StudioMessageLayout'; | ||
| import StudioEmailField from '../../components/form/StudioEmailField'; | ||
| import StudioBanner from '../../../shared/views/StudioBanner'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: Use the aliases |
||
| import { generateFormMixin } from '../../../shared/mixins.js'; | ||
|
|
||
| const formFields = { | ||
| email: { | ||
| required: true, | ||
| validator: value => Boolean(value && /.+@.+\..+/.test(value)), | ||
| }, | ||
| }; | ||
|
|
||
| export default { | ||
| name: 'ForgotPassword', | ||
|
|
||
| mixins: [generateFormMixin(formFields)], | ||
|
|
||
| components: { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. blocking: Linting CI fails: |
||
| MessageLayout, | ||
| EmailField, | ||
| Banner, | ||
| StudioMessageLayout, | ||
| StudioEmailField, | ||
| StudioBanner, | ||
| }, | ||
|
|
||
| data() { | ||
| return { | ||
| email: '', | ||
| error: false, | ||
| emailValidationVisible: false, | ||
| }; | ||
| }, | ||
|
|
||
| computed: { | ||
| emailErrors() { | ||
| if (!this.emailValidationVisible || !this.errors.email) { | ||
| return []; | ||
| } | ||
|
|
||
| return [this.$tr('validEmailMessage')]; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: An empty email now shows "Please enter a valid email" instead of "This field is required". That breaks the "no functional differences" AC. Handle both cases as |
||
| }, | ||
| }, | ||
|
|
||
| methods: { | ||
| ...mapActions('account', ['sendPasswordResetLink']), | ||
|
|
||
| hideEmailError() { | ||
| this.emailValidationVisible = false; | ||
| }, | ||
|
|
||
| showEmailError() { | ||
| this.emailValidationVisible = true; | ||
| }, | ||
|
|
||
| submit() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. praise: Validation and the payload both use the same trimmed email. QA confirmed a padded email posts as |
||
| this.error = false; | ||
| if (this.$refs.form.validate()) { | ||
| this.sendPasswordResetLink(this.email) | ||
| .then(() => { | ||
| this.$router | ||
| .push({ | ||
| name: 'PasswordInstructionsSent', | ||
| }) | ||
| .catch(() => {}); | ||
| }) | ||
| .catch(() => { | ||
| this.error = true; | ||
| }); | ||
|
|
||
| const formData = this.clean(); | ||
|
|
||
| if (!this.validate(formData)) { | ||
| this.emailValidationVisible = true; | ||
| return; | ||
| } | ||
|
|
||
| this.sendPasswordResetLink(formData.email) | ||
| .then(() => { | ||
| this.$router | ||
| .push({ | ||
| name: 'PasswordInstructionsSent', | ||
| }) | ||
| .catch(() => {}); | ||
| }) | ||
| .catch(() => { | ||
| this.error = true; | ||
| }); | ||
| }, | ||
| }, | ||
|
|
||
| $trs: { | ||
| forgotPasswordTitle: 'Reset your password', | ||
| forgotPasswordPrompt: | ||
| 'Please enter your email address to receive instructions for resetting your password', | ||
| submitButton: 'Submit', | ||
| forgotPasswordFailed: 'Failed to send a password reset link. Please try again.', | ||
| validEmailMessage: 'Please enter a valid email', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: On |
||
| }, | ||
| }; | ||
|
|
||
|
|
@@ -85,8 +134,19 @@ | |
|
|
||
| <style lang="scss" scoped> | ||
|
|
||
| .forgot-password-form { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: The validation message and banner text are centred, while the label and input are left-aligned ( |
||
| width: 400px; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. blocking: The form is cut off at 320px and 360px widths. The form, field and Submit stay 400px wide. LTR loses the right edge;
|
||
| max-width: 100%; | ||
| margin: 0 auto; | ||
| } | ||
|
|
||
| .email-field { | ||
| margin-bottom: 24px; | ||
| } | ||
|
|
||
| .w-100 { | ||
| width: 100%; | ||
| display: block; | ||
| width: 100% !important; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: This override also forces |
||
| } | ||
|
|
||
| </style> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Screen-reader users hear nothing when the failure banner appears. It has no live region. Add
role="alert", asAccountsMain.vue:36does. Also replace the Vuetifymb-4helper with a scoped class (.banner { margin-bottom: 16px }inRequestNewActivationLink.vue).