]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/pages/admin/support/SupportRevokeCertificatesForm.java
fix: ResultSet.getDate is often wrong as it fetches day-precision times
[gigi.git] / src / org / cacert / gigi / pages / admin / support / SupportRevokeCertificatesForm.java
index 8c106dcb5d8d6bbd3cf5fdfd1e12e86dd2925cf7..5b163cc46af10ab6f82a158102b01b605e0003c0 100644 (file)
@@ -13,12 +13,9 @@ import org.cacert.gigi.dbObjects.Certificate;
 import org.cacert.gigi.dbObjects.Certificate.CertificateStatus;
 import org.cacert.gigi.dbObjects.CertificateProfile;
 import org.cacert.gigi.dbObjects.SupportedUser;
-import org.cacert.gigi.dbObjects.User;
 import org.cacert.gigi.localisation.Language;
 import org.cacert.gigi.output.template.Form;
 import org.cacert.gigi.output.template.IterableDataset;
-import org.cacert.gigi.output.template.Outputable;
-import org.cacert.gigi.output.template.SprintfCommand;
 import org.cacert.gigi.output.template.Template;
 
 public class SupportRevokeCertificatesForm extends Form {
@@ -33,21 +30,12 @@ public class SupportRevokeCertificatesForm extends Form {
     }
 
     @Override
-    public boolean submit(PrintWriter out, HttpServletRequest req) throws GigiApiException {
-        if (user.getTicket() != null) {
-            user.revokeAllCertificates();
-            User target = user.getTargetUser();
-            // send notification to support
-            String subject = "Revoke certificates";
-            Outputable message = SprintfCommand.createSimple("All certificates in the account {0} <{1}> have been revoked.", target.getPreferredName().toString(), target.getEmail());
-            user.sendSupportNotification(subject, message);
-            // send notification to user
-            subject = "Revoke certificate";
-            message = SprintfCommand.createSimple("All certificates in your account have been revoked.");
-            user.sendSupportUserNotification(subject, message);
-            return true;
+    public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
+        if (user.getTicket() == null) {
+            throw new GigiApiException("No ticket number set.");
         }
-        return false;
+        user.revokeAllCertificates();
+        return new RedirectResult(req.getPathInfo());
     }
 
     @Override