Results 1 to 6 of 6

Thread: Custom user sign up page

  1. #1
    Join Date
    Nov 2006
    Posts
    52
    Rep Power
    9

    Question Custom user sign up page

    Hello,

    I have a free community edition installed and I want to enable users to register for mail accounts themselves. In other I need a "register here" link that takes a user to an interface that will let a user create a mailbox. So my question is what's the best way to do it?
    Any suggestions.

  2. #2
    Join Date
    Jun 2006
    Location
    Washington DC
    Posts
    124
    Rep Power
    9

    Default

    Well, that's a scary thought really.
    You would need some kind of approval process somewhere or all the spammers in the world will use your server to do their bidding and then abandon the account afterwards.
    Anything that you find will need to have admin access as well so, another scary thought.

    Food for thought.

    You trying to do like Gmail, Yahoo, Hotmail, etc., are doing?

    There is a command line option to add accounts I believe, but you would need to build a webpage that would sit between you and the users to do this, as you would have to give that process admin rights to create accounts and such.

    Maybe you need to look for an ISP type of app/product if this is what you want. Lots of bad things to check for if going to be publicly accessable in this.

    my .02 worth anyway.... ;-)

    Scotty

  3. #3
    Join Date
    Nov 2006
    Posts
    52
    Rep Power
    9

    Default I understand

    Oh yeah, I totally understand that. That is part of my job to check all that stuff.
    I was wondering if there is already some kinda plugin that enables you to do that. Otherwise I will simply create a Servlet that will do that for me. You mention that is command to do that. Now that is what I want. If you know what it is off the too of your head I 'd appreciate it. Or I will just google it.

    Thanks.

  4. #4
    Join Date
    Sep 2012
    Location
    jhoncarter2030@gmail.com
    Posts
    61
    Rep Power
    3

    Default

    Have you found any solution?

  5. #5
    Join Date
    Nov 2006
    Posts
    52
    Rep Power
    9

    Default

    I have indeed...



    import java.io.*;
    import java.util.HashMap;
    import java.util.Map;

    import com.zimbra.cs.account.Provisioning;

    import javax.servlet.http.*;
    import javax.servlet.*;

    public class UserRegistration extends HttpServlet {
    private String errorPage;
    public void init() {
    ServletConfig config = getServletConfig();
    errorPage = config.getInitParameter("errorPage");
    }

    public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{
    String redirect = "";
    boolean okFlag = true;
    String fname = (String)getNullValue(req.getParameter("fname"));
    String lname = (String)getNullValue(req.getParameter("lname"));
    String login = (String)getNullValue(req.getParameter("login"));
    String password = (String)getNullValue(req.getParameter("password")) ;
    String password_conf = (String)getNullValue(req.getParameter("conf_passwo rd"));
    String streetAddress = (String)getNullValue(req.getParameter("streetAddre ss"));
    String phone = (String)getNullValue(req.getParameter("phone"));
    String zip = (String)getNullValue(req.getParameter("zip"));
    String state = (String)getNullValue(req.getParameter("state"));
    String country = (String)getNullValue(req.getParameter("country"));
    String city = (String)getNullValue(req.getParameter("city"));
    PrintWriter out = res.getWriter();
    //The reson it is broken down like this is if login is null statement (login.length() == 0) will
    //throw a NUll pointer
    if(login == null){
    redirect = "errorMsg: Login field cannot be empty";
    okFlag = false;
    }else if(login.length() == 0){
    redirect = "errorMsg: Login field cannot be empty";
    okFlag = false;
    }

    if (password == null){
    redirect = "errorMsg: Password must be at least 6 characters long";
    okFlag = false;
    }else if(password.length() < 6){
    redirect = "errorMsg: Password must be at least 6 characters long";
    okFlag = false;
    }else{
    if(!password.equals(password_conf)){
    redirect = "errorMsg: Passwords do not match";
    okFlag = false;
    }
    }

    if(okFlag){
    Map attrs = new HashMap();
    attrs.put("zimbraMailHost", "oaxy.com");
    attrs.put("cn", fname + " " + lname);
    attrs.put("displayName", fname + " " + lname);
    attrs.put("gn", fname);
    attrs.put("sn", lname);
    attrs.put("telephoneNumber", phone);
    attrs.put("street", streetAddress);
    attrs.put("l", city);
    attrs.put("st", state);
    attrs.put("co", country);
    attrs.put("postalCode", zip);

    try{
    Provisioning.getInstance().createAccount(login + "@oaxy.com", password, attrs);
    redirect = login;
    }
    catch(Exception e){
    redirect = "errorMsg: Error adding account: " + e.getMessage();
    }
    }
    out.println(redirect);


    }
    public void doPost (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{
    doGet(req, res);
    }

    private Object getNullValue(Object o){
    if(o == null){
    return null;
    }
    String tmp = (String)o;
    if (tmp == ""){
    return null;
    }else if(tmp.length() > 0){
    return tmp;
    }

    return o;
    }
    }

  6. #6
    Join Date
    Sep 2012
    Location
    jhoncarter2030@gmail.com
    Posts
    61
    Rep Power
    3

    Default

    Thanks a lot.

Similar Threads

  1. Replies: 21
    Last Post: 02-04-2010, 10:06 AM
  2. Post instsallation problems
    By Assaf in forum Installation
    Replies: 14
    Last Post: 01-29-2007, 11:38 AM
  3. Getting problems in FC4 while instalation
    By kitty_bhoo in forum Installation
    Replies: 13
    Last Post: 09-12-2006, 11:34 PM
  4. Services stopped working
    By lilwong in forum Administrators
    Replies: 4
    Last Post: 08-15-2006, 10:19 AM
  5. Fedora Core 3, Clean Install - Not working!
    By pcjackson in forum Installation
    Replies: 17
    Last Post: 03-05-2006, 07:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •