Check if it is zombie user's username or email

This commit is contained in:
Sofia Baltzi 2017-11-08 12:00:59 +00:00
parent 7314282429
commit b02517e740
2 changed files with 9 additions and 3 deletions

View File

@ -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 <a href=\"https://www.openaire.eu/support/helpdesk\">helpdesk</a>.");
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);

View File

@ -47,7 +47,7 @@
<div class="uk-width-1-1">
<h3 class="uk-h3 uk-text-danger">Oops! Something went wrong</h3>
<div class="middle-box loginscreen animated fadeInDown uk-text-left ">
<p>Something went wrong. Please try again later or contact openAIRE <a href="https://www.openaire.eu/support/helpdesk">helpdesk</a>. We apologize for the inconvenience.</p>
<p>Something went wrong. Please try again later or contact OpenAIRE <a href="https://www.openaire.eu/support/helpdesk">helpdesk</a>. We apologize for the inconvenience.</p>
</div>
</div>