File tree Expand file tree Collapse file tree 6 files changed +15
-4
lines changed
test/java/ru/mystamps/web/tests/cases Expand file tree Collapse file tree 6 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ public final class SiteMap {
34
34
// defined at src/main/resources/spring/DispatcherServletContext.xml
35
35
public static final String INDEX_PAGE_URL = "/" ;
36
36
public static final String MAINTENANCE_PAGE_URL = "/site/maintenance" ;
37
+ public static final String SUCCESSFUL_REGISTRATION_PAGE_URL = "/successful/registration" ;
38
+ public static final String SUCCESSFUL_ACTIVATION_PAGE_URL = "/successful/activation" ;
37
39
38
40
public static final String REGISTRATION_PAGE_URL = "/account/register" ;
39
41
public static final String AUTHENTICATION_PAGE_URL = "/account/auth" ;
Original file line number Diff line number Diff line change 38
38
39
39
import static ru .mystamps .web .SiteMap .ACTIVATE_ACCOUNT_PAGE_URL ;
40
40
import static ru .mystamps .web .SiteMap .ACTIVATE_ACCOUNT_PAGE_WITH_KEY_URL ;
41
+ import static ru .mystamps .web .SiteMap .SUCCESSFUL_ACTIVATION_PAGE_URL ;
41
42
42
43
@ Controller
43
44
public class ActivateAccountController {
@@ -91,7 +92,7 @@ public String processInput(
91
92
form .getActivationKey ()
92
93
);
93
94
94
- return "account/activation_successful" ;
95
+ return "redirect:" + SUCCESSFUL_ACTIVATION_PAGE_URL ;
95
96
}
96
97
97
98
}
Original file line number Diff line number Diff line change 34
34
import ru .mystamps .web .validation .RegisterAccountValidator ;
35
35
36
36
import static ru .mystamps .web .SiteMap .REGISTRATION_PAGE_URL ;
37
+ import static ru .mystamps .web .SiteMap .SUCCESSFUL_REGISTRATION_PAGE_URL ;
37
38
38
39
@ Controller
39
40
@ RequestMapping (REGISTRATION_PAGE_URL )
@@ -73,8 +74,7 @@ public String processInput(
73
74
74
75
userService .addRegistrationRequest (form .getEmail ());
75
76
76
- // TODO: do redirect to protect from double submission (#74)
77
- return "account/activation_sent" ;
77
+ return "redirect:" + SUCCESSFUL_REGISTRATION_PAGE_URL ;
78
78
}
79
79
80
80
}
Original file line number Diff line number Diff line change 32
32
<mvc : view-controller path =" /" view-name =" site/index" />
33
33
<mvc : view-controller path =" /site/maintenance" view-name =" site/maintenance" />
34
34
<mvc : view-controller path =" /password/restore" view-name =" password/restore" />
35
+ <mvc : view-controller path =" /successful/registration" view-name =" account/activation_sent" />
36
+ <mvc : view-controller path =" /successful/activation" view-name =" account/activation_successful" />
35
37
36
38
<import resource =" database.xml" />
37
39
Original file line number Diff line number Diff line change 40
40
41
41
import static ru .mystamps .web .SiteMap .ACTIVATE_ACCOUNT_PAGE_WITH_KEY_URL ;
42
42
import static ru .mystamps .web .SiteMap .AUTHENTICATION_PAGE_URL ;
43
+ import static ru .mystamps .web .SiteMap .SUCCESSFUL_ACTIVATION_PAGE_URL ;
43
44
44
45
@ RunWith (SpringJUnit4ClassRunner .class )
45
46
@ ContextConfiguration (locations = "classpath:spring/TestContext.xml" )
@@ -278,6 +279,8 @@ public void afterActivationShouldExistsMessageWithLinkForAuthentication() {
278
279
page .fillField ("activationKey" , NOT_ACTIVATED_USER_ACT_KEY );
279
280
page .submit ();
280
281
282
+ assertThat (page .getCurrentUrl ()).isEqualTo (SUCCESSFUL_ACTIVATION_PAGE_URL );
283
+
281
284
assertThat (page .textPresent (stripHtmlTags (tr ("t_activation_successful" )))).isTrue ();
282
285
283
286
assertThat (page .linkHasLabelAndPointsTo ("authentication" , AUTHENTICATION_PAGE_URL ))
Original file line number Diff line number Diff line change 22
22
23
23
import static ru .mystamps .web .SiteMap .AUTHENTICATION_PAGE_URL ;
24
24
import static ru .mystamps .web .SiteMap .RESTORE_PASSWORD_PAGE_URL ;
25
+ import static ru .mystamps .web .SiteMap .SUCCESSFUL_REGISTRATION_PAGE_URL ;
25
26
import static ru .mystamps .web .tests .TranslationUtils .tr ;
26
27
import static ru .mystamps .web .tests .TranslationUtils .stripHtmlTags ;
27
28
import static ru .mystamps .web .validation .ValidationRules .EMAIL_MAX_LENGTH ;
@@ -99,7 +100,9 @@ public void emailShouldBeStripedFromLeadingAndTrailingSpaces() {
99
100
public void successfulMessageShouldBeShownAfterRegistration () {
100
101
page .fillField ("email" , "coder@rock.home" );
101
102
page .submit ();
102
- // TODO: check page url
103
+
104
+ assertThat (page .getCurrentUrl ()).isEqualTo (SUCCESSFUL_REGISTRATION_PAGE_URL );
105
+
103
106
assertThat (page .textPresent (tr ("t_activation_sent_message" ))).isTrue ();
104
107
}
105
108
You can’t perform that action at this time.
0 commit comments