From b02517e7401be0bd1f1a11f7082221cca4cf3a32 Mon Sep 17 00:00:00 2001 From: Sofia Baltzi <> Date: Wed, 8 Nov 2017 12:00:59 +0000 Subject: [PATCH] Check if it is zombie user's username or email --- .../openaire/usermanagement/RegisterServlet.java | 10 ++++++++-- src/main/webapp/error.jsp | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/dnetlib/openaire/usermanagement/RegisterServlet.java b/src/main/java/eu/dnetlib/openaire/usermanagement/RegisterServlet.java index f7f846b..6701213 100644 --- a/src/main/java/eu/dnetlib/openaire/usermanagement/RegisterServlet.java +++ b/src/main/java/eu/dnetlib/openaire/usermanagement/RegisterServlet.java @@ -62,7 +62,8 @@ public class RegisterServlet extends HttpServlet { try { - if (username.matches("^[a-zA-Z0-9][a-zA-Z0-9_-]{4,150}") && !ldapActions.usernameExists(username) && !ldapActions.emailExists(email)) { + if (username.matches("^[a-zA-Z0-9][a-zA-Z0-9_-]{4,150}") && !ldapActions.usernameExists(username) && !ldapActions.emailExists(email) + && !ldapActions.isZombieUsersEmail(email) && !ldapActions.isZombieUsersUsername(username)) { ldapActions.createZombieUser(username, email, firstName, lastName, organization, password); logger.info("Zombie user successfully created"); @@ -118,7 +119,7 @@ public class RegisterServlet extends HttpServlet { } } - if (ldapActions.usernameExists(username)) { + if (ldapActions.usernameExists(username) || ldapActions.isZombieUsersUsername(username)) { request.getSession().setAttribute("username_message", "Username already exists! Choose another one."); logger.info("Username already exists"); } @@ -128,6 +129,11 @@ public class RegisterServlet extends HttpServlet { logger.info("There is another user with this email"); } + if (ldapActions.isZombieUsersEmail(email)) { + request.getSession().setAttribute("email_message", "You have already registered with this email address! Please check your email to activate your account or contact OpenAIRE helpdesk."); + logger.info("There is another user with this email"); + } + request.getSession().setAttribute("first_name", firstName); request.getSession().setAttribute("last_name", lastName); request.getSession().setAttribute("organization", organization); diff --git a/src/main/webapp/error.jsp b/src/main/webapp/error.jsp index 7949483..b291fa0 100644 --- a/src/main/webapp/error.jsp +++ b/src/main/webapp/error.jsp @@ -47,7 +47,7 @@