Revision 49747
Added by Sofia Baltzi over 6 years ago
RegisterServlet.java | ||
---|---|---|
62 | 62 |
|
63 | 63 |
try { |
64 | 64 |
|
65 |
// if (ldapActions.usernameExists(username)) { |
|
66 |
// request.getSession().setAttribute("username_message", "Username already exists! Choose another one."); |
|
67 |
// logger.info("Username already exists"); |
|
68 |
// response.sendRedirect("./register.jsp"); |
|
69 |
// |
|
70 |
// } else if (ldapActions.emailExists(email)) { |
|
71 |
// request.getSession().setAttribute("email_message", "There is another user with this email."); |
|
72 |
// logger.info("There is another user with this email"); |
|
73 |
// response.sendRedirect("./register.jsp"); |
|
74 |
// |
|
75 |
// } else { |
|
76 |
|
|
77 | 65 |
if (username.matches("^[a-zA-Z0-9][a-zA-Z0-9_-]{4,150}") && !ldapActions.usernameExists(username) && !ldapActions.emailExists(email)) { |
78 | 66 |
|
79 | 67 |
ldapActions.createUser(username, email, firstName, lastName, organization/*, password*/); |
... | ... | |
103 | 91 |
|
104 | 92 |
emailSender.sendEmail(email, verificationCodeSubject, verificationCodeMsg); |
105 | 93 |
|
94 |
response.sendRedirect("./activate.jsp"); |
|
106 | 95 |
|
107 |
response.sendRedirect("./activate.jsp"); |
|
108 |
// } |
|
109 | 96 |
} else { |
110 | 97 |
|
111 | 98 |
if(!username.matches("^[a-zA-Z0-9][a-zA-Z0-9_-]{4,150}")){ |
... | ... | |
131 | 118 |
logger.info("There is another user with this email"); |
132 | 119 |
} |
133 | 120 |
|
121 |
request.getSession().setAttribute("first_name", firstName); |
|
122 |
request.getSession().setAttribute("last_name", lastName); |
|
123 |
request.getSession().setAttribute("organization", organization); |
|
124 |
request.getSession().setAttribute("username", username); |
|
125 |
request.getSession().setAttribute("email", email); |
|
126 |
request.getSession().setAttribute("email_conf", confirmEmail); |
|
127 |
|
|
134 | 128 |
response.sendRedirect("./register.jsp"); |
135 | 129 |
} |
136 | 130 |
|
Also available in: Unified diff
Add variables in session