@@ -28,7 +28,9 @@ Feature: Forgot password system
2828 Given there is a "password_update" form
2929 When I send a "GET" request to the resource "password_update_form" and the postfix "<postfix>"
3030 Then the response status code should be 200
31+ And the JSON node "formView.children[0].vars.name" should be equal to "username"
3132 And the JSON node "formView.children[0].vars.value" should be equal to "<expectedUsername>"
33+ And the JSON node "formView.children[1].vars.name" should be equal to "plainNewPasswordConfirmationToken"
3234 And the JSON node "formView.children[1].vars.value" should be equal to "<expectedToken>"
3335 Examples :
3436 | postfix | expectedUsername | expectedToken |
@@ -44,17 +46,41 @@ Feature: Forgot password system
4446 {
4547 "password_update": {
4648 "username": "username",
47- "newPasswordConfirmationToken ": "abc123",
49+ "plainNewPasswordConfirmationToken ": "abc123",
4850 "plainPassword": {
4951 "first": "mynewpassword",
5052 "second": "mynewpassword"
5153 }
5254 }
5355 }
5456 """
55- Then the response status code should be 200
57+ Then the response status code should be 201
5658 And I should get a "password_changed" email sent to the email address "test.user@example.com"
5759
60+ Scenario Outline : I cannot reset my password with an invalid token
61+ Given there is a "password_update" form
62+ And there is a user with the username "username" password "password" and role "ROLE_USER"
63+ And the user has the newPasswordConfirmationToken "abc123" requested at "now"
64+ When I send a "POST" request to the resource "password_update_form" and the postfix "/submit" with body:
65+ """
66+ {
67+ "password_update": {
68+ "username": "username",
69+ "plainNewPasswordConfirmationToken": "INVALID",
70+ "plainPassword": {
71+ "first": "<password>",
72+ "second": "<password>"
73+ }
74+ }
75+ }
76+ """
77+ Then the response status code should be <statusCode>
78+ And I should not receive any emails
79+ Examples :
80+ | password | statusCode |
81+ | a | 422 |
82+ | mynewpassword | 404 |
83+
5884 Scenario Outline : I cannot reset my password with invalid data
5985 Given there is a "password_update" form
6086 And there is a user with the username "username" password "password" and role "ROLE_USER"
@@ -64,7 +90,7 @@ Feature: Forgot password system
6490 {
6591 "password_update": {
6692 "username": "<username>",
67- "newPasswordConfirmationToken ": "<token>",
93+ "plainNewPasswordConfirmationToken ": "<token>",
6894 "plainPassword": {
6995 "first": "mynewpassword",
7096 "second": "mynewpassword"
@@ -90,7 +116,7 @@ Feature: Forgot password system
90116 {
91117 "password_update": {
92118 "username": "username",
93- "newPasswordConfirmationToken ": "abc123",
119+ "plainNewPasswordConfirmationToken ": "abc123",
94120 "plainPassword": {
95121 "first": "<passwordFirst>",
96122 "second": "<passwordSecond>"
@@ -110,18 +136,19 @@ Feature: Forgot password system
110136 Scenario : I can reset my password successfully without a specific password update form component being required
111137 Given there is a user with the username "username" password "password" and role "ROLE_USER"
112138 And the user has the newPasswordConfirmationToken "abc123" requested at "now"
113- When I send a "PATCH " request to "/component/forms/password_reset/submit" with body:
139+ When I send a "POST " request to "/component/forms/password_reset/submit" with body:
114140 """
115141 {
116142 "password_update": {
117143 "username": "username",
118- "newPasswordConfirmationToken ": "abc123",
144+ "plainNewPasswordConfirmationToken ": "abc123",
119145 "plainPassword": {
120146 "first": "mynewpassword",
121147 "second": "mynewpassword"
122148 }
123149 }
124150 }
125151 """
126- Then the response status code should be 200
152+ Then the response status code should be 201
127153 And I should get a "password_changed" email sent to the email address "test.user@example.com"
154+ And the JSON should be valid according to the schema file "form.schema.json"
0 commit comments