<? foreach($assurances) {?>
<tr>
<? if($support) { ?>
-<td><a href="/support/user/<?=$linkId?>"><?=$id?></a></td>
+<td><a href="/support/user/<?=$linkId?>/"><?=$id?></a></td>
<? } else { ?>
<td><?=$id?></td>
<? } ?>
public String getSuccessPath(Form f) {
CertificateOwner res = ((FindUserByDomainForm) f).getRes();
if (res instanceof User) {
- return SupportUserDetailsPage.PATH + res.getId();
+ return SupportUserDetailsPage.PATH + res.getId() + "/";
} else if (res instanceof Organisation) {
return "/support/domain/" + res.getId();
} else {
<tr>
<th>Id</th><th>E-Mail</th></tr>
<? foreach($usertable) {?>
- <tr><td><a href="/support/user/<?=$usrid?>"><?=$usrid?></a></td><td><a href="/support/user/<?=$usrid?>"><?=$usermail?></a></td></tr>
+ <tr><td><a href="/support/user/<?=$usrid?>/"><?=$usrid?></a></td><td><a href="/support/user/<?=$usrid?>/"><?=$usermail?></a></td></tr>
<? } ?>
</table>
<? } ?>
form.submit(resp.getWriter(), req);
final EmailAddress[] emails = form.getEmails();
if (emails.length == 1) {
- resp.sendRedirect(SupportUserDetailsPage.PATH + emails[0].getOwner().getId());
+ resp.sendRedirect(SupportUserDetailsPage.PATH + emails[0].getOwner().getId() + "/");
} else {
HashMap<String, Object> vars = new HashMap<String, Object>();
vars.put("first", false);
vars.put("dob", dobSelector);
vars.put("assurancepoints", user.getAssurancePoints());
vars.put("exppoints", user.getExperiencePoints());
- vars.put("id", user.getId());
final Set<Group> gr = user.getGroups();
vars.put("groups", new IterableDataset() {
</tr>
<tr>
<td><?=_Trainings?>:</td>
- <td><a href="./<?=$id?>/trainings"><?=_Show?></a></td>
+ <td><a href="trainings"><?=_Show?></a></td>
</tr>
<tr>
<td><?=_Is RA Agent?>:</td>
</tr>
<tr>
<td><?=_Verification Points?>:</td>
- <td><?=$assurancepoints?> (<a href="./<?=$id?>/points"><?=_Show?></a>)</td>
+ <td><?=$assurancepoints?> (<a href="./points"><?=_Show?></a>)</td>
</tr>
<tr>
<td><?=_Experience Points?>:</td>
<td><?=_Show Lost Password Details?></td>
</tr>
<tr>
- <td colspan="2"><a href="./<?=$id?>/history"><?=_Show account history?></a></td>
+ <td colspan="2"><a href="history"><?=_Show account history?></a></td>
</tr>
<tr><td colspan="2"><input name="detailupdate" type="submit" value="<?=_Update?>"/></td></tr>
</tbody>
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
int id = -1;
+ if ( !req.getPathInfo().endsWith("/")) {
+ resp.sendError(404);
+ }
String[] idP = req.getPathInfo().split("/");
try {
id = Integer.parseInt(idP[idP.length - 1]);
@Test
public void testChangeAccountData() throws MalformedURLException, IOException {
- executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID, "dobd=1&dobm=2&doby=2000&detailupdate", 0);
+ executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID + "/", "dobd=1&dobm=2&doby=2000&detailupdate", 0);
String message = getMailReceiver().receive().getMessage();
assertThat(message, containsString("The account data was changed."));
@Test
public void testPasswordReset() throws MalformedURLException, IOException {
- executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID, "aword=SecretWord&resetPass", 0);
+ executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID + "/", "aword=SecretWord&resetPass", 0);
TestMail tm;
String targetMail = ServerConstants.getSupportMailAddress();
do {
@Test
public void testGrantUserGroup() throws MalformedURLException, IOException {
- executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID, "grant&groupToModify=supporter", 0);
+ executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID + "/", "grant&groupToModify=supporter", 0);
String message = getMailReceiver().receive().getMessage();
assertThat(message, containsString("The group permission supporter was granted."));
@Test
public void testRemoveUserGroup() throws MalformedURLException, IOException {
- executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID, "deny&groupToModify=supporter", 0);
+ executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID + "/", "deny&groupToModify=supporter", 0);
String message = getMailReceiver().receive().getMessage();
assertThat(message, containsString("The group permission supporter was revoked."));
@Test
public void testRevokeCertificates() throws MalformedURLException, IOException {
- executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID, "revokeall", 1);
+ executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID + "/", "revokeall", 1);
String message = getMailReceiver().receive().getMessage();
assertThat(message, containsString("All certificates in the account have been revoked."));
String fname = "Först";
String lname = "Secönd";
int id = createVerifiedUser(fname, lname, email, TEST_PASSWORD);
- URLConnection uc = get(SupportUserDetailsPage.PATH + id);
+ URLConnection uc = get(SupportUserDetailsPage.PATH + id + "/");
uc.setDoOutput(true);
String res = IOUtils.readURL(uc);
assertThat(res, containsString(fname));
ea = EmailAddress.getById(ea.getId());
assertTrue(ea.isVerified());
- String res = IOUtils.readURL(get(SupportUserDetailsPage.PATH + id));
+ String res = IOUtils.readURL(get(SupportUserDetailsPage.PATH + id + "/"));
assertEquals(2, countRegex(res, Pattern.quote(email)));
assertEquals(1, countRegex(res, Pattern.quote(email2)));
User.getById(id).updateDefaultEmail(ea);
clearCaches();
- res = IOUtils.readURL(get(SupportUserDetailsPage.PATH + id));
+ res = IOUtils.readURL(get(SupportUserDetailsPage.PATH + id + "/"));
assertEquals(1, countRegex(res, Pattern.quote(email)));
assertEquals(2, countRegex(res, Pattern.quote(email2)));
}
assertEquals(0, logCountAdmin(id));
assertEquals(0, logCountUser(clientCookie));
// changing both leads to 2 entries
- assertNull(executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + id, "dobd=1&dobm=2&doby=2000&detailupdate", 0));
+ assertNull(executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + id + "/", "dobd=1&dobm=2&doby=2000&detailupdate", 0));
assertEquals(1, logCountAdmin(id));
assertEquals(1, logCountUser(clientCookie));
// Sending same data keeps same
- assertNull(executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + id, "dobd=1&dobm=2&doby=2000&detailupdate", 0));
+ assertNull(executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + id + "/", "dobd=1&dobm=2&doby=2000&detailupdate", 0));
assertEquals(1, logCountAdmin(id));
assertEquals(1, logCountUser(clientCookie));
// changing one leads to one entry
- assertNull(executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + id, "dobd=1&dobm=3&doby=2000&detailupdate", 0));
+ assertNull(executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + id + "/", "dobd=1&dobm=3&doby=2000&detailupdate", 0));
assertEquals(2, logCountAdmin(id));
assertEquals(2, logCountUser(clientCookie));
// changing one leads to one entry
- assertNull(executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + id, "dobd=2&dobm=3&doby=2000&detailupdate", 0));
+ assertNull(executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + id + "/", "dobd=2&dobm=3&doby=2000&detailupdate", 0));
assertEquals(3, logCountAdmin(id));
assertEquals(3, logCountUser(clientCookie));
// changing none -> no entry
- assertNull(executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + id, "dobd=2&dobm=3&doby=2000&detailupdate", 0));
+ assertNull(executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + id + "/", "dobd=2&dobm=3&doby=2000&detailupdate", 0));
assertEquals(3, logCountAdmin(id));
assertEquals(3, logCountUser(clientCookie));
public void testDomainSearch() throws MalformedURLException, UnsupportedEncodingException, IOException, GigiApiException {
URLConnection uc = post(FindUserByDomainPage.PATH, "process&domain=" + URLEncoder.encode(domainName, "UTF-8"));
- assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + tid, uc.getHeaderField("Location"));
+ assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + tid + "/", uc.getHeaderField("Location"));
}
@Test
public void testDomainSearchById() throws MalformedURLException, UnsupportedEncodingException, IOException, GigiApiException {
URLConnection uc = post(FindUserByDomainPage.PATH, "process&domain=#" + d.getId());
- assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + tid, uc.getHeaderField("Location"));
+ assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + tid + "/", uc.getHeaderField("Location"));
}
@Test
int id = createVerifiedUser("Först", "Secönd", mail, TEST_PASSWORD);
URLConnection uc = post(cookie, FindUserByEmailPage.PATH, "process&email=" + URLEncoder.encode(mail, "UTF-8"), 0);
- assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + id, uc.getHeaderField("Location"));
+ assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + id + "/", uc.getHeaderField("Location"));
}
@Test
int id = createVerifiedUser("Först", "Secönd", mail, TEST_PASSWORD);
URLConnection uc = post(cookie, FindUserByEmailPage.PATH, "process&email=" + URLEncoder.encode("%@example.tld", "UTF-8"), 0);
- assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + id, uc.getHeaderField("Location"));
+ assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + id + "/", uc.getHeaderField("Location"));
}
@Test
URLConnection uc = post(cookie, FindUserByEmailPage.PATH, "process&email=" + URLEncoder.encode("%@example.org", "UTF-8"), 0);
String res = IOUtils.readURL(uc);
- assertThat(res, containsString(SupportUserDetailsPage.PATH + id));
- assertThat(res, containsString(SupportUserDetailsPage.PATH + id2));
+ assertThat(res, containsString(SupportUserDetailsPage.PATH + id + "/"));
+ assertThat(res, containsString(SupportUserDetailsPage.PATH + id2 + "/"));
}
@Test
URLConnection uc = post(cookie, FindUserByEmailPage.PATH, "process&email=" + URLEncoder.encode("%@_xample.org", "UTF-8"), 0);
String res = IOUtils.readURL(uc);
- assertThat(res, containsString(SupportUserDetailsPage.PATH + id));
- assertThat(res, containsString(SupportUserDetailsPage.PATH + id2));
+ assertThat(res, containsString(SupportUserDetailsPage.PATH + id + "/"));
+ assertThat(res, containsString(SupportUserDetailsPage.PATH + id2 + "/"));
}
@Test
createVerifiedEmail(testuser, mail2);
URLConnection uc = post(cookie, FindUserByEmailPage.PATH, "process&email=" + URLEncoder.encode(mail2, "UTF-8"), 0);
- assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + id, uc.getHeaderField("Location"));
+ assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + id + "/", uc.getHeaderField("Location"));
}
@Test
createVerifiedEmail(testuser, mail3);
URLConnection uc = post(cookie, FindUserByEmailPage.PATH, "process&email=" + URLEncoder.encode("%@example3.org", "UTF-8"), 0);
- assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + id, uc.getHeaderField("Location"));
+ assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + id + "/", uc.getHeaderField("Location"));
uc = post(cookie, FindUserByEmailPage.PATH, "process&email=" + URLEncoder.encode("%@test3.org", "UTF-8"), 0);