view src/nabble/view/web/mailing_list/Subscribe2.java @ 19:18cf4872fd7f

remove anonymous posting
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 29 May 2020 22:58:25 -0600
parents 7ecd1a4ef557
children
line wrap: on
line source


package nabble.view.web.mailing_list;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import fschmidt.util.mail.MailAddress;
import nabble.model.Node;
import nabble.model.ListServer;
import nabble.model.MailingList;
import nabble.model.ModelHome;
import nabble.model.User;
import nabble.view.lib.Jtp;
import nabble.view.lib.Shared;


public final class Subscribe2 extends HttpServlet {

	protected void service(HttpServletRequest request,HttpServletResponse response)
		throws ServletException, IOException
	{
		PrintWriter out = response.getWriter();
		String context = request.getContextPath();
		User user = Jtp.getUser(request);
		if( user==null ) {
			Jtp.login("You must login to be able to subscribe to a list.",request,response);
			return;
		}
		Node forum = Jtp.getSiteNotNull(request).getNode(Long.parseLong(request.getParameter("forum")));
		MailingList mailingList = forum.getAssociatedMailingList();
		ListServer listServer = mailingList.getListServer();
		MailAddress emailAddress = new MailAddress(user.getEmail(), user.getName());
		
		out.print( "\n<html>\n<head>\n" );

		Shared.title(request,response,"Subscribe to mailing list");
		
		out.print( "\n</head>\n<body>\n" );
 Shared.minHeader(request, response, forum); 
		out.print( "\n<h1>Subscription Request Was Sent</h1>\n<p>\nA subscription request was sent on your behalf to the mailing list: <strong>" );
		out.print( (mailingList.getListAddress()) );
		out.print( "</strong>.\nYou will soon receive a confirmation request by email at <strong>" );
		out.print( (user.getEmail()) );
		out.print( "</strong>. Please follow the\ninstructions in the email to complete your subscription.\n</p>\n\n<p>\nTo ensure that your posts are accepted by the mailing list, complete the subscription process before posting any messages to this forum.  If you have already posted messages that have not been accepted by the mailing list, you will need to resend them after you have finished subscribing.\n</p>\n\n<p><strong>Remember:</strong> You are not subscribed to the <strong>" );
		out.print( (mailingList.getListAddress()) );
		out.print( "</strong> list until you have followed the instructions in the email.</p>\n\n" );

		if( listServer.needsDefaults() && listServer!=ListServer.google ) {
			
		out.print( "\n<p>\nAlso, we have sent you an email to help you turn off list mail delivery to your email address (" );
		out.print( (user.getEmail()) );
		out.print( "). After your subscription has been approved, please click the corresponding link in the email to turn off list mail delivery.\n</p>\n" );

		}
		
		out.print( "\n<br /><br />\n<p>\n&#171; <a href=\"" );
		out.print( (Jtp.path(forum)) );
		out.print( "\">Return to forum</a><br /><br />\n</p>\n" );

		Shared.footer(request,response);
		
		out.print( "\n" );
 Shared.analytics(request,response); 
		out.print( "\n</body>\n</html>\n" );

	}

}