X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2FdbObjects%2FSupportedUser.java;h=e5daeb31bc0be4923418d595b006147068385f6b;hp=a4a3ba121e2c7dbab18d1646a46f9a2575138bbc;hb=4ff2f7a462e9d6ef5171b7d0a4c8d3cf3f26c024;hpb=f5eae3344a5999304bf9cad2c119dcfc064f3003 diff --git a/src/org/cacert/gigi/dbObjects/SupportedUser.java b/src/org/cacert/gigi/dbObjects/SupportedUser.java index a4a3ba12..e5daeb31 100644 --- a/src/org/cacert/gigi/dbObjects/SupportedUser.java +++ b/src/org/cacert/gigi/dbObjects/SupportedUser.java @@ -10,6 +10,7 @@ import org.cacert.gigi.dbObjects.Certificate.CertificateStatus; import org.cacert.gigi.localisation.Language; import org.cacert.gigi.output.template.MailTemplate; import org.cacert.gigi.output.template.Outputable; +import org.cacert.gigi.output.template.SprintfCommand; import org.cacert.gigi.util.DayDate; import org.cacert.gigi.util.ServerConstants; @@ -53,6 +54,14 @@ public class SupportedUser { if (cert.getStatus() == CertificateStatus.ISSUED) { writeSELog("SE Revoke certificate"); cert.revoke().waitFor(60000); + // send notification to support + String subject = "Revoke certificate"; + Outputable message = SprintfCommand.createSimple("Certificate with serial number {0} for {1} <{2}>, has been revoked.", cert.getSerial(), target.getPreferredName().toString(), target.getEmail()); + sendSupportNotification(subject, message); + // send notification to user + subject = "Revoke certificate"; + message = SprintfCommand.createSimple("Certificate with serial number {0} with subject distinguished name {1} has been revoked.", cert.getSerial(), cert.getDistinguishedName()); + sendSupportUserNotification(subject, message); } } @@ -109,4 +118,19 @@ public class SupportedUser { e.printStackTrace(); } } + + private static final MailTemplate supportUserNotification = new MailTemplate(SupportedUser.class.getResource("SupportUserNotificationMail.templ")); + + public void sendSupportUserNotification(String subject, Outputable message) { + try { + HashMap vars = new HashMap<>(); + vars.put("action", message); + vars.put("ticket", this.getTicket()); + vars.put("subject", subject); + + supportUserNotification.sendMail(Language.getInstance(Locale.ENGLISH), vars, target.getEmail()); + } catch (IOException e) { + e.printStackTrace(); + } + } }