X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Fapi%2FEmailReping.java;fp=src%2Forg%2Fcacert%2Fgigi%2Fapi%2FEmailReping.java;h=0000000000000000000000000000000000000000;hp=e2c3383f391242a546014cb6116bf0604b87adfc;hb=bccd4cc0dba0f89aa045b113bac46eb8cc1dab4e;hpb=c9ed09f0007fc2c813815be927a5a24b23dab83c diff --git a/src/org/cacert/gigi/api/EmailReping.java b/src/org/cacert/gigi/api/EmailReping.java deleted file mode 100644 index e2c3383f..00000000 --- a/src/org/cacert/gigi/api/EmailReping.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.cacert.gigi.api; - -import java.io.IOException; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.cacert.gigi.GigiApiException; -import org.cacert.gigi.dbObjects.EmailAddress; -import org.cacert.gigi.dbObjects.User; -import org.cacert.gigi.localisation.Language; - -public class EmailReping extends APIPoint { - - public static final String PATH = "/account/emails/reping"; - - @Override - protected void process(HttpServletRequest req, HttpServletResponse resp, User u) throws IOException { - try { - String email = req.getParameter("email"); - if (email == null) { - resp.sendError(500, "No parameter 'email'."); - return; - } - for (EmailAddress e : u.getEmails()) { - if (e.getAddress().equals(email)) { - e.requestReping(Language.getInstance(u.getPreferredLocale())); - resp.setContentType("text/plain; charset=UTF-8"); - return; - } - } - resp.sendError(500, "Error, Email address not found."); - } catch (IllegalArgumentException e) { - resp.sendError(500, "Invalid email"); - } catch (GigiApiException e) { - resp.setStatus(500); - resp.setContentType("text/plain; charset=UTF-8"); - e.formatPlain(resp.getWriter()); - } - } -}