diff options
author | Vitaly Takmazov | 2018-11-30 13:47:56 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-11-30 13:47:56 +0300 |
commit | 4af8dfbaf86cdfd31b466dec3c10060090bf46b7 (patch) | |
tree | d429994ebda69491176d8cf7ff0d10bb516ec67e | |
parent | 4034b885d3e934eb45c87b5377579fbbeb909544 (diff) |
XMPP link error page
-rw-r--r-- | src/main/java/com/juick/server/www/controllers/SignUp.java | 6 | ||||
-rw-r--r-- | src/test/java/com/juick/server/tests/ServerTests.java | 17 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/main/java/com/juick/server/www/controllers/SignUp.java b/src/main/java/com/juick/server/www/controllers/SignUp.java index e33b16cd..30223952 100644 --- a/src/main/java/com/juick/server/www/controllers/SignUp.java +++ b/src/main/java/com/juick/server/www/controllers/SignUp.java @@ -129,6 +129,11 @@ public class SignUp { emailService.addEmail(uid, email); emailService.deleteAuthCode(hash); } else { + if (type.equals("xmpp")) { + modelMap.addAttribute("visitor", visitor); + modelMap.addAttribute("result", "XMPP support is disabled for new users"); + return "views/settings_result"; + } throw new HttpBadRequestException(); } } @@ -154,6 +159,7 @@ public class SignUp { emailService.deleteAuthCode(hash); } else { if (type.equals("xmpp")) { + modelMap.addAttribute("visitor", visitor); modelMap.addAttribute("result", "XMPP support is disabled for new users"); return "views/settings_result"; } diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 41fbe434..cc42383b 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -1825,4 +1825,21 @@ public class ServerTests { Message reply = result.getNewMessage().get(); assertThat(commandsManager.processCommand(ugnich, String.format("#%d/%d *GOOD *BAD", reply.getMid(), reply.getRid()), emptyUri).getText(), startsWith("Reply posted")); } + + @Test + public void XMPPSignupIsDisabled() throws Exception { + jdbcTemplate.update("INSERT INTO jids(loginhash, jid) VALUES('1', 'test@jid.tld')"); + MvcResult formLoginResult = mockMvc.perform(post("/login") + .param("username", ugnichName) + .param("password", ugnichPassword)) + .andExpect(status().is3xxRedirection()).andReturn(); + Cookie rememberMeFromForm = formLoginResult.getResponse().getCookie("juick-remember-me"); + mockMvc.perform(post("/signup") + .cookie(rememberMeFromForm) + .param("hash", "1") + .param("type", "xmpp") + .param("action", "link")) + .andExpect(status().isOk()) + .andExpect(content().string(containsString("XMPP support is disabled"))); + } } |