|
|
|
@ -329,6 +329,7 @@ public class Web extends HttpServlet {
@@ -329,6 +329,7 @@ public class Web extends HttpServlet {
|
|
|
|
|
data.put(NAME,name); |
|
|
|
|
data.put(EMAIL,email); |
|
|
|
|
data.put(LIST,listEmail); |
|
|
|
|
var skipConfirmation = false; |
|
|
|
|
|
|
|
|
|
var list = MailingList.load(listEmail); |
|
|
|
|
|
|
|
|
@ -351,6 +352,7 @@ public class Web extends HttpServlet {
@@ -351,6 +352,7 @@ public class Web extends HttpServlet {
|
|
|
|
|
int code = cause.getErrorCode(); |
|
|
|
|
if (code == PRIMARY_KEY_CONSTRAINT) try {// user already exists
|
|
|
|
|
user = User.loadUser(email,pass); |
|
|
|
|
skipConfirmation = pass != null; // subscription with email address already known to database
|
|
|
|
|
// success → subscribe
|
|
|
|
|
} catch (InvalidKeyException | SQLException e) { |
|
|
|
|
// invalid credentials
|
|
|
|
@ -361,7 +363,7 @@ public class Web extends HttpServlet {
@@ -361,7 +363,7 @@ public class Web extends HttpServlet {
|
|
|
|
|
data.put(USER,user.safeMap()); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
list.requestSubscription(user); |
|
|
|
|
list.requestSubscription(user,skipConfirmation); |
|
|
|
|
data.put(NOTES,t("Successfully subscribed '{}' to '{}'.",user.email(),list.email())); |
|
|
|
|
return loadTemplate(INDEX,data,resp); |
|
|
|
|
} catch (SQLException sqle) { |
|
|
|
|