Commit dff1bfe20903b0bb07bbf6cb1e622bd39fe06958

Authored by Andrew Shvayka
Committed by GitHub
2 parents 849f53ca f69c31f0

Merge pull request #176 from volodymyr-babak/feature/fix-for-IE-redirect

Fixed IE issue with redirect. 308 return code doesn't work. 303 does.…
... ... @@ -107,7 +107,7 @@ public class AuthController extends BaseController {
107 107 try {
108 108 URI location = new URI(createPasswordURI + "?activateToken=" + activateToken);
109 109 headers.setLocation(location);
110   - responseStatus = HttpStatus.PERMANENT_REDIRECT;
  110 + responseStatus = HttpStatus.SEE_OTHER;
111 111 } catch (URISyntaxException e) {
112 112 log.error("Unable to create URI with address [{}]", createPasswordURI);
113 113 responseStatus = HttpStatus.BAD_REQUEST;
... ... @@ -146,7 +146,7 @@ public class AuthController extends BaseController {
146 146 try {
147 147 URI location = new URI(resetPasswordURI + "?resetToken=" + resetToken);
148 148 headers.setLocation(location);
149   - responseStatus = HttpStatus.PERMANENT_REDIRECT;
  149 + responseStatus = HttpStatus.SEE_OTHER;
150 150 } catch (URISyntaxException e) {
151 151 log.error("Unable to create URI with address [{}]", resetPasswordURI);
152 152 responseStatus = HttpStatus.BAD_REQUEST;
... ...
... ... @@ -200,7 +200,7 @@ public abstract class AbstractControllerTest {
200 200 User savedUser = doPost("/api/user", user, User.class);
201 201 logout();
202 202 doGet("/api/noauth/activate?activateToken={activateToken}", TestMailService.currentActivateToken)
203   - .andExpect(status().isPermanentRedirect())
  203 + .andExpect(status().isSeeOther())
204 204 .andExpect(header().string(HttpHeaders.LOCATION, "/login/createPassword?activateToken=" + TestMailService.currentActivateToken));
205 205 JsonNode tokenInfo = readResponse(doPost("/api/noauth/activate", "activateToken", TestMailService.currentActivateToken, "password", password).andExpect(status().isOk()), JsonNode.class);
206 206 validateAndSetJwtToken(tokenInfo, user.getEmail());
... ...
... ... @@ -70,7 +70,7 @@ public class UserControllerTest extends AbstractControllerTest {
70 70
71 71 logout();
72 72 doGet("/api/noauth/activate?activateToken={activateToken}", TestMailService.currentActivateToken)
73   - .andExpect(status().isPermanentRedirect())
  73 + .andExpect(status().isSeeOther())
74 74 .andExpect(header().string(HttpHeaders.LOCATION, "/login/createPassword?activateToken=" + TestMailService.currentActivateToken));
75 75
76 76 JsonNode tokenInfo = readResponse(doPost("/api/noauth/activate", "activateToken", TestMailService.currentActivateToken, "password", "testPassword").andExpect(status().isOk()), JsonNode.class);
... ... @@ -120,7 +120,7 @@ public class UserControllerTest extends AbstractControllerTest {
120 120 doPost("/api/noauth/resetPasswordByEmail", "email", email)
121 121 .andExpect(status().isOk());
122 122 doGet("/api/noauth/resetPassword?resetToken={resetToken}", TestMailService.currentResetPasswordToken)
123   - .andExpect(status().isPermanentRedirect())
  123 + .andExpect(status().isSeeOther())
124 124 .andExpect(header().string(HttpHeaders.LOCATION, "/login/resetPassword?resetToken=" + TestMailService.currentResetPasswordToken));
125 125
126 126 JsonNode tokenInfo = readResponse(doPost("/api/noauth/resetPassword", "resetToken", TestMailService.currentResetPasswordToken, "password", "testPassword2").andExpect(status().isOk()), JsonNode.class);
... ...