Skip to content

Commit ad5326c

Browse files
committed
feat(api): WIP fill email input with email query parameter value
1 parent d8ed44d commit ad5326c

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

mon-pix/app/components/authentication/password-reset-demand/password-reset-demand-form.gjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ export default class PasswordResetDemandForm extends Component {
1818
@service requestManager;
1919
@service storage;
2020
@service url;
21+
@service router;
2122

2223
@tracked globalError = this.errors.hasErrors && this.errors.shift();
2324
@tracked isLoading = false;
2425
@tracked isPasswordResetDemandReceived = false;
2526

2627
constructor() {
2728
super(...arguments);
28-
this.email = this.storage.getLogin();
29+
this.email = this.storage.getLogin() || this.router.currentRoute.queryParams?.email;
2930
}
3031

3132
validation = new FormValidation({

mon-pix/tests/integration/components/authentication/password-reset-demand/password-reset-demand-form-test.gjs

+14
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,20 @@ module('Integration | Component | Authentication | PasswordResetDemand | passwor
5555
assert.strictEqual(link.getAttribute('href'), 'https://pix.fr/support');
5656
});
5757

58+
module('when the email to reset is passed in query parameters', function () {
59+
test('it displays the given email address in email input', async function (assert) {
60+
// given
61+
const routerService = this.owner.lookup('service:router');
62+
sinon.stub(routerService, 'router');
63+
64+
// when
65+
const screen = await render(<template><PasswordResetDemandForm /></template>);
66+
67+
// then
68+
assert.dom(screen.queryByRole('textbox', { name: 'Adresse e-mail' })).exists();
69+
});
70+
});
71+
5872
module('email input validation', function () {
5973
module('when the email input is valid', function () {
6074
test('it doesn’t display any error message', async function (assert) {

0 commit comments

Comments
 (0)