@Override
public void apply(Certificate t, Language l, Map<String, Object> vars) {
- vars.put("id", t.getId());
vars.put("serial", t.getSerial());
+ vars.put("draftinfo", t.getStatus() == CertificateStatus.DRAFT ? l.getTranslation("Draft") : "");
if (t.getStatus() == CertificateStatus.REVOKED) {
vars.put("revoked", t.getRevocationDate());
<p><?=_Multiple certificates?>: <?=$limit?></p>
<table class="table">
<tr>
-<th>Id</th><th><?=_Serial number?></th><th><?=_SAN?></th><th><?=_Revocation Date?></th></tr>
+<th><?=_Serial number?></th><th><?=_SAN?></th><th><?=_Revocation Date?></th></tr>
<? foreach($certtable) {?>
<tr>
- <td><a href="/support/certs/<?=$serial?>"><?=$id?></a></td>
- <td><a href="/support/certs/<?=$serial?>"><?=$serial?></a></td>
+ <td><a href="/support/certs/<?=$serial?>"><?=$serial?></a> <?=$draftinfo?></td>
<td>
<? foreach($san) {?>
<?=$entry?>
package club.wpia.gigi.pages.admin;
+import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import java.io.IOException;
assertThat(result, CoreMatchers.containsString("N/A"));
}
+ @Test
+ public void testShowDraft() throws GeneralSecurityException, IOException, GigiApiException, InterruptedException {
+ KeyPair kp = generateKeypair();
+ String key = generatePEMCSR(kp, "CN=" + certMail);
+ Certificate c1 = new Certificate(u, u, Certificate.buildDN("CN", certMail), Digest.SHA512, key, CSRType.CSR, getClientProfile(), new Certificate.SubjectAlternateName(SANType.EMAIL, certMail));
+ URLConnection uc = post(cookie, FindCertPage.PATH, "certType=email&process=Next&cert=" + URLEncoder.encode(certMail, "UTF-8"), 0);
+ String result = IOUtils.readURL(uc);
+ assertThat(result, CoreMatchers.containsString(c.getSerial()));
+ assertThat(result, CoreMatchers.containsString("Draft"));
+
+ await(c1.issue(null, "2y", u));
+ uc = post(cookie, FindCertPage.PATH, "certType=email&process=Next&cert=" + URLEncoder.encode(certMail, "UTF-8"), 0);
+ result = IOUtils.readURL(uc);
+ assertThat(result, CoreMatchers.containsString(c.getSerial()));
+ assertThat(result, CoreMatchers.containsString(c1.getSerial()));
+ assertThat(result, not(CoreMatchers.containsString("Draft")));
+ }
+
private Certificate createCertificate() throws GeneralSecurityException, IOException, GigiApiException, InterruptedException {
User u1 = User.getById(id);
KeyPair kp = generateKeypair();