Complete ldapmodify about zombies and users :P at front end

This commit is contained in:
Sofia Baltzi 2017-11-06 13:51:36 +00:00
parent 3a5c87f914
commit d58ca25c5e
3 changed files with 24 additions and 1 deletions

View File

@ -1,5 +1,6 @@
package eu.dnetlib.openaire.usermanagement;
import eu.dnetlib.openaire.user.utils.LDAPActions;
import eu.dnetlib.openaire.user.utils.VerificationActions;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@ -28,6 +29,10 @@ public class ActivationCodeServlet extends HttpServlet{
@Autowired
private VerificationActions verificationActions;
@Autowired
private LDAPActions ldapActions;
private Logger logger = Logger.getLogger(ActivationCodeServlet.class);
@Override
@ -42,6 +47,12 @@ public class ActivationCodeServlet extends HttpServlet{
if (!verificationActions.verificationCodeHasExpired(formUsername)) {
HttpSession session = request.getSession();
session.setAttribute("username", formUsername);
try {
ldapActions.moveUser(formUsername);
} catch (Exception e) {
logger.error("LDAP error in moving user", e);
response.sendRedirect("./error.jsp");
}
response.sendRedirect("./registerSuccess.jsp");
} else {
logger.info("Verification code has expired!");

View File

@ -64,7 +64,7 @@ public class RegisterServlet extends HttpServlet {
if (username.matches("^[a-zA-Z0-9][a-zA-Z0-9_-]{4,150}") && !ldapActions.usernameExists(username) && !ldapActions.emailExists(email)) {
ldapActions.createUser(username, email, firstName, lastName, organization, password);
ldapActions.createZombieUser(username, email, firstName, lastName, organization, password);
logger.info("User successfully created");
UUID verificationCode = UUID.randomUUID();

View File

@ -63,6 +63,18 @@
<url-pattern>/register</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Register2Servlet</servlet-name>
<display-name>Register2</display-name>
<servlet-class>eu.dnetlib.openaire.usermanagement.Register2Servlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Register2Servlet</servlet-name>
<url-pattern>/register2</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>VerificationCodeServlet</servlet-name>
<display-name>Verify code</display-name>