|
|
|
@ -26,6 +26,7 @@ public class Web extends TemplateServlet {
@@ -26,6 +26,7 @@ public class Web extends TemplateServlet {
|
|
|
|
|
public static final String WEB_ROOT = "/web"; |
|
|
|
|
private static final String ADD_LIST = "add_list"; |
|
|
|
|
private static final String CONFIRM = "confirm"; |
|
|
|
|
private static final String CSS = "css"; |
|
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(Web.class); |
|
|
|
|
private static final String ADMIN = "admin"; |
|
|
|
|
private static final String INSPECT = "inspect"; |
|
|
|
@ -178,17 +179,14 @@ public class Web extends TemplateServlet {
@@ -178,17 +179,14 @@ public class Web extends TemplateServlet {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String handleGet(HttpServletRequest req, HttpServletResponse resp) { |
|
|
|
|
var path = req.getPathInfo(); |
|
|
|
|
if (path == null) return redirectTo(INDEX,resp); |
|
|
|
|
var o = req.getSession().getAttribute("user"); |
|
|
|
|
User user = o instanceof User ? (User) o : null; |
|
|
|
|
var path = Util.getPath(req); |
|
|
|
|
var user = Util.getUser(req); |
|
|
|
|
var data = new HashMap<String,Object>(); |
|
|
|
|
var list = Util.getMailingList(req); |
|
|
|
|
|
|
|
|
|
if (user != null) data.put(USER,user.safeMap()); |
|
|
|
|
path = path.equals("/") ? INDEX : path.substring(1); |
|
|
|
|
String notes = null; |
|
|
|
|
var listEmail = req.getParameter(LIST); |
|
|
|
|
var list = MailingList.load(listEmail); |
|
|
|
|
if (list != null) data.put(LIST,list.minimalMap()); |
|
|
|
|
String notes = null; |
|
|
|
|
switch (path){ |
|
|
|
|
case ARCHIVE: |
|
|
|
|
return archive(req,resp); |
|
|
|
@ -200,13 +198,14 @@ public class Web extends TemplateServlet {
@@ -200,13 +198,14 @@ public class Web extends TemplateServlet {
|
|
|
|
|
loadTemplates(); |
|
|
|
|
data.put(NOTES,t("Vorlagen wurden neu geladen")); |
|
|
|
|
path = INDEX; |
|
|
|
|
case "css": |
|
|
|
|
case INDEX: |
|
|
|
|
case UNSUBSCRIBE: |
|
|
|
|
data.put(LIST,list.email()); |
|
|
|
|
case CSS: |
|
|
|
|
case INDEX: |
|
|
|
|
return loadTemplate(path,data,resp); |
|
|
|
|
case SUBSCRIBE: |
|
|
|
|
if (list.isOpenFor(user)) { |
|
|
|
|
data.put(LIST,listEmail); |
|
|
|
|
data.put(LIST,list.email()); |
|
|
|
|
return loadTemplate(path, data, resp); |
|
|
|
|
} |
|
|
|
|
return t("Es ist ihnen nicht gestattet, '{}' zu abonnieren!",list.email()); |
|
|
|
@ -258,9 +257,7 @@ public class Web extends TemplateServlet {
@@ -258,9 +257,7 @@ public class Web extends TemplateServlet {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String handlePost(HttpServletRequest req, HttpServletResponse resp) { |
|
|
|
|
final var user = Util.getUser(req); |
|
|
|
|
final var path = Util.getPath(req); |
|
|
|
|
final var list = Util.getMailingList(req); |
|
|
|
|
|
|
|
|
|
switch (path){ |
|
|
|
|
case ADD_LIST: |
|
|
|
@ -382,14 +379,13 @@ public class Web extends TemplateServlet {
@@ -382,14 +379,13 @@ public class Web extends TemplateServlet {
|
|
|
|
|
var name = req.getParameter(NAME); |
|
|
|
|
var email = req.getParameter(EMAIL); |
|
|
|
|
var pass = req.getParameter(PASSWORD); |
|
|
|
|
var listEmail = req.getParameter(LIST); |
|
|
|
|
var list = Util.getMailingList(req); |
|
|
|
|
var data = new HashMap<String,Object>(); |
|
|
|
|
data.put(NAME,name); |
|
|
|
|
data.put(EMAIL,email); |
|
|
|
|
data.put(LIST,listEmail); |
|
|
|
|
if (list != null) data.put(LIST,list.email()); |
|
|
|
|
var skipConfirmation = false; |
|
|
|
|
|
|
|
|
|
var list = MailingList.load(listEmail); |
|
|
|
|
|
|
|
|
|
if (list == null){ |
|
|
|
|
data.put(ERROR,"Formular-Daten enthalten keine Liste!"); |
|
|
|
@ -454,24 +450,19 @@ public class Web extends TemplateServlet {
@@ -454,24 +450,19 @@ public class Web extends TemplateServlet {
|
|
|
|
|
var data = new HashMap<String,Object>(); |
|
|
|
|
var user = getSessionUser(req); |
|
|
|
|
var email = req.getParameter(EMAIL); |
|
|
|
|
var pass = req.getParameter(PASSWORD); |
|
|
|
|
var listEmail = req.getParameter(LIST); |
|
|
|
|
var list = Util.getMailingList(req); |
|
|
|
|
data.put(EMAIL,email); |
|
|
|
|
data.put(LIST,listEmail); |
|
|
|
|
|
|
|
|
|
var list = MailingList.load(listEmail); |
|
|
|
|
|
|
|
|
|
if (user != null) data.put(USER,user.safeMap()); |
|
|
|
|
if (list == null){ |
|
|
|
|
data.put(ERROR,"Keine Mailin-Liste in den Formular-Daten übermittelt!!"); |
|
|
|
|
return loadTemplate(UNSUBSCRIBE,data,resp); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} else data.put(LIST,list.email()); |
|
|
|
|
if (user == null) { |
|
|
|
|
if (email == null || email.isBlank()) { |
|
|
|
|
data.put(ERROR, "Für das Abbestellen ist eine E-Mail-Adresse erforderlich!"); |
|
|
|
|
return loadTemplate(UNSUBSCRIBE, data, resp); |
|
|
|
|
} |
|
|
|
|
var pass = req.getParameter(PASSWORD); |
|
|
|
|
if (pass != null && pass.isBlank()) pass = null; |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|