Basic servlet status for username reminder and password reset

This commit is contained in:
Katerina Iatropoulou 2017-10-02 14:26:59 +00:00
parent 6ecff7923d
commit d095152d8c
22 changed files with 2433 additions and 12 deletions

10
pom.xml
View File

@ -34,6 +34,16 @@
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>eu.dnetlib</groupId>
<artifactId>uoa-user-management</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,86 @@
package eu.dnetlib.openaire.usermanagement;
import com.unboundid.ldap.sdk.LDAPException;
import eu.dnetlib.openaire.user.utils.EmailActions;
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;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;
import java.util.UUID;
/**
* Created by kiatrop on 28/9/2017.
*/
public class ForgotPasswordServlet extends HttpServlet {
public void init(ServletConfig config) throws ServletException {
super.init(config);
SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this,
config.getServletContext());
}
@Autowired
private LDAPActions ldapActions;
@Autowired
private VerificationActions verificationActions;
private EmailActions emailActions;
private Logger logger = Logger.getLogger(ForgotPasswordServlet.class);
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
String formEmail = (String)request.getAttribute("email");
if (formEmail == null) {
request.getSession().setAttribute("message", "Error reading email.");
response.sendRedirect("./forgotPassword.jsp");
}
try {
String userEmail = ldapActions.getUsername(formEmail);
if (userEmail == null) {
request.getSession().setAttribute("message", "User does not exist.");
response.sendRedirect("./forgotPassword.jsp");
} else {
String username = ldapActions.getUsername(userEmail);
UUID verificationCode = UUID.randomUUID();
Date creationDate = new Date();
if (verificationActions.verificationEntryExists(username)) {
verificationActions.addVerificationEntry(username, verificationCode.toString(), creationDate);
} else {
verificationActions.updateVerificationEntry(username, verificationCode.toString(), creationDate);
}
emailActions.sendVerificationCode(userEmail);
}
} catch (LDAPException ldape) {
//TODO create error page
request.getSession().setAttribute("message", "Error sending email.");
response.sendRedirect("./forgotPassword.jsp");
}
response.setContentType("text/html");
response.sendRedirect("./verify.jsp");
}
}

View File

@ -0,0 +1,64 @@
package eu.dnetlib.openaire.usermanagement;
import com.unboundid.ldap.sdk.LDAPException;
import eu.dnetlib.openaire.user.utils.EmailActions;
import eu.dnetlib.openaire.user.utils.LDAPActions;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Created by kiatrop on 2/10/2017.
*/
@Component
public class RemindUsernameServlet extends HttpServlet {
public void init(ServletConfig config) throws ServletException {
super.init(config);
SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this,
config.getServletContext());
}
@Autowired
private LDAPActions ldapActions;
private EmailActions emailActions;
private Logger logger = Logger.getLogger(RemindUsernameServlet.class);
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
String formEmail = request.getParameter("email");
if (formEmail == null){
request.getSession().setAttribute("message", "Error reading email.");
response.sendRedirect("./remindUsername.jsp");
}
try{
String username = ldapActions.getUsername(formEmail);
if ( username != null && !username.isEmpty()) {
//emailActions.sendUsernameReminder(formEmail);
} else {
request.getSession().setAttribute("message", "User not found");
response.sendRedirect("./remindUsername.jsp");
}
} catch (LDAPException ldape) {
//TODO create error page
logger.error("Could not find user with email " + formEmail, ldape);
response.sendRedirect("./error.jsp");
}
}
}

View File

@ -0,0 +1,49 @@
package eu.dnetlib.openaire.usermanagement;
import eu.dnetlib.openaire.user.utils.LDAPActions;
import eu.dnetlib.openaire.user.utils.VerificationActions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
/**
* Created by kiatrop on 28/9/2017.
*/
public class ResetPasswordServlet extends HttpServlet {
public void init(ServletConfig config) throws ServletException {
super.init(config);
SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this,
config.getServletContext());
}
@Autowired
private VerificationActions verificationActions;
@Autowired
private LDAPActions ldapActions;
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("text/html");
PrintWriter printWriter = response.getWriter();
String password = (String)request.getAttribute("password");
String confirmPassword = (String)request.getAttribute("confirmPassword");
if (password.equals(confirmPassword)) {
//TODO update ldap
//ldapActions.update()
}
response.sendRedirect("./success.jsp");
printWriter.close();
}
}

View File

@ -0,0 +1,47 @@
package eu.dnetlib.openaire.usermanagement;
import eu.dnetlib.openaire.user.utils.VerificationActions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
/**
* Created by kiatrop on 28/9/2017.
*/
public class VerificationCodeServlet extends HttpServlet {
public void init(ServletConfig config) throws ServletException {
super.init(config);
SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this,
config.getServletContext());
}
@Autowired
private VerificationActions verificationActions;
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("text/html");
PrintWriter printWriter = response.getWriter();
String formUsername = (String)request.getAttribute("username");
String formVerificationCode = (String)request.getAttribute("verification_code");
if (verificationActions.verificationEntryExists(formUsername, formVerificationCode)) {
response.sendRedirect("./resetPassword.jsp");
} else {
response.sendRedirect("./error.jsp");
}
response.sendRedirect("./resetPassword.jsp");
printWriter.close();
}
}

View File

@ -4,7 +4,7 @@ log4j.logger.eu.dnetlib = DEBUG
log4j.logger.org.mitre.openid = DEBUG
log4j.logger.org.springframework = DEBUG, S
#log4j.additivity.org.springframework = false
log4j.additivity.org.springframework = false
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=/var/log/dnet/user-management/user-management.log

View File

@ -39,6 +39,54 @@
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ForgotPasswordServlet</servlet-name>
<display-name>Forgot Password</display-name>
<servlet-class>eu.dnetlib.openaire.usermanagement.ForgotPasswordServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ForgotPasswordServlet</servlet-name>
<url-pattern>/forgotPassword</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>VerificationCodeServlet</servlet-name>
<display-name>Verify code</display-name>
<servlet-class>eu.dnetlib.openaire.usermanagement.VerificationCodeServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>VerificationCodeServlet</servlet-name>
<url-pattern>/verifyCode</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ResetPasswordServlet</servlet-name>
<display-name>Reset password</display-name>
<servlet-class>eu.dnetlib.openaire.usermanagement.ResetPasswordServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ResetPasswordServlet</servlet-name>
<url-pattern>/resetPassword</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>RemindUsernameServlet</servlet-name>
<display-name>Username Reminder</display-name>
<servlet-class>eu.dnetlib.openaire.usermanagement.RemindUsernameServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>RemindUsernameServlet</servlet-name>
<url-pattern>/remindUsername</url-pattern>
</servlet-mapping>
<filter>
<filter-name>CorsFilter</filter-name>
@ -65,17 +113,6 @@
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--
<filter>
<filter-name>requestContextFilter</filter-name>
<filter-class>org.springframework.web.filter.RequestContextFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>requestContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
-->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>

View File

@ -0,0 +1,9 @@
.aai-form-danger,.aai-form-danger:focus {
color:#f0506e;
border-color:#f0506e
}
h6, .aai-h6 {
text-transform: initial !important;
font-variant: small-caps;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,322 @@
.tm-toolbar .uk-subnav-line .custom-discover-li {
color:#05007A !important;
background:#fff;
display: block;
}
.tm-toolbar .uk-subnav-line .custom-discover-li a{
color:#05007A !important;
}
.custom-discover-toolbar ul.uk-subnav.uk-subnav-line{
background-color: #f25f30 !important;
}
.custom-discover-toolbar .inner {
background-color: #f25f30 !important;
}
.custom-discover-toolbar{
border-top-color:#f25f30 !important;
}
.custom-footer{
position:relative;
bottom:0;
left:0;
}
.custom-external {
background: rgba(0, 0, 0, 0) url("/assets/icon_external.png") no-repeat scroll left center;
padding: 0 0 0 16px;
}
.custom-navbar-toggle-icon, .custom-user-mini-panel{
color:#444 !important
}
.custom-user-mini-panel a{
color:rgb(36, 91, 204);
}
.custom-main-content{
min-height: 550px;
}
.custom-autocomplete .uk-nav-autocomplete > li > a:hover {
background: #00a8e6 none repeat scroll 0 0;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.05) inset;
color: #FFF;
outline: medium none;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1);
}
.custom-autocomplete .uk-nav-navbar > li > a {
color: #444;
}
.custom-description-list-horizontal{ line-height:200%}
.uk-alert-default {
background: #fff none repeat scroll 0 0;
border: 1px solid #ddd;
border-radius: 4px;
color: #444;
height: 30px;
max-width: 100%;
padding: 4px 6px;
}
.custom-hidden-dropdown-menu {position:static !important;}
.searchFilterBoxValues {overflow:auto; max-height:200px; }
.selected-filters-box {margin:5px; background-color:#F8F8F8; }
.search-form {margin:5px; }
.clickable { cursor:pointer; }
.search-filters .uk-accordion-title{
font-size: 14px;
line-height: 18px;
}
.search-results {
min-height: 1100px;
}
.other-results {
min-height: 300px;
}
.OPEN {
background: rgba(0, 0, 0, 0) url("/assets/openAccess.png") no-repeat scroll right center;
padding-right: 18px;
min-height: 18px;
}
.EMBARGO, .CLOSED, .RESTRICTED {
background: rgba(0, 0, 0, 0) url("/assets/closedAccess.png") no-repeat scroll right center;
padding-right: 18px;
}
.sc39 {
background: rgba(0, 0, 0, 0) url("/assets/sc39.png") no-repeat scroll right center;
padding-right: 24px;
}
.projectIcon {
display: inline-table;
}
.dateFilter .mydp{
margin-top:5px;
}
/*.tooltip {
max-width: none;
background: rgba(100, 100, 100, 1);
}*/
.tooltip-custom-font-size {
font-size: 120%;
}
.custom-select-mini{
max-width:170px !important;
}
.custom-icon {
line-height: unset;
}
/*.custom-tab-content-large{
min-height: 800px;
}
*/
.custom-tab-content {
min-height: 250px;
}
.custom-dataTable-content {
min-height: 600px;
}
.custom-html-table-height {
height: 500px;
}
.filterItem span {
display: inline-flex;
}
.filterItem .filterName {
max-width: 71%;
}
.browseFilters .filterItem .filterName {
max-width: 68%;
}
.filterItem .filterNumber {
width: 20%;
}
.filterItem span {
white-space: nowrap;
}
.browseFilters .filterItem span div {
/*min-width: 45px;*/
}
.filterItem span div {
overflow: hidden;
text-overflow: ellipsis;
/*min-width: 81px;*/
}
.browseFilters{
overflow-y: auto;
overflow-x: hidden;
max-height:265px;
}
.custom-offcanvas-close {
position: relative;
right: 0;
top: 0;
}
.uk-link{
color: #292C3D !important;
}
.uk-breadcrumb > :last-child > * {
color:#cbcbcb !important;
}
.uk-breadcrumb .uk-active a{
color: #767779 !important;
}
.publicationTitleIcon {
background: url("/assets/publication.png") no-repeat;
}
.datasetTitleIcon {
background: url("/assets/dataset.png") no-repeat;
}
.projectTitleIcon {
background: url("/assets/project.png") no-repeat;
}
.organizationTitleIcon {
background: url("/assets/organization.png") no-repeat;
}
.datasourceTitleIcon {
background: url("/assets/datasource.png") no-repeat;
}
.entityTitleIcon{
background-repeat: :no-repeat;
content: '';
display: inline-block;
height: 36px;
width: 42px;
vertical-align: middle;
}
.entityIcon{
height: 15px;
width: 20px;
}
/*.uk-tab{
border-bottom: 1px #cbcbcb solid;
}*/
.label-underCuration{
background: #fef5d2 !important;
}
.label-blue {
background:#d4f3ff;
color:#00a0de
}
.label-green {
background:#d1f6e8;
color:#01a566
}
.label-yellow {
background:#fef5d2;
color:#cca607
}
.label-red {
background:#fef0ef;
color:#f54f43
}
.label-grey{
background: #f8f8f8;
color: #666;
}
.label-orange{
background: #fef5d2;
color: #f0506e;
}
.uk-tab {
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-ms-flex-wrap: wrap;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
margin-left: -20px;
padding: 0;
list-style: none;
position: relative;
}
.uk-tab::before {
content: "";
position: absolute;
bottom: 0;
left: 20px;
right: 0;
border-bottom: 1px solid #e5e5e5;
}
.mainPageSearchForm{
background-image: url("./globe_tech.jpg"); background-color: rgb(255, 255, 255); box-sizing: border-box; min-height: calc(100vh - 412.767px);
}
.searchForm, .publicationsSearchForm, .projectsSearchForm, .organizationsSearchForm, .datasetsSearchForm, .datasourcesSearchForm, .journalsSearchForm,
.entityRegistriesSearchForm, .compatibleDatasourcesSearchForm,
.journalsTableSearchForm, .compatibleDatasourcesTableSearchForm, .entityRegistriesTableSearchForm{
background-image: url('./formImage.jpg'); box-sizing: border-box; height: 250px;
}
.divider-table tbody td, .uk-table th {
border-bottom: 1px solid #E5E5E5;
}
#feedback {
float: left;
position: fixed;
top: calc(50% - 47px);
right: 0;
}
#feedback a {
background: #F25F30;
border-radius: 5px 0 0 5px;
box-shadow: 0 0 3px rgba(0, 0, 0, .3);
border: 3px solid #fff;
border-right: 0;
display: block;
padding: 20px 12px;
transition: all .2s ease-in-out;
}
#feedback a:hover {
padding-right: 20px;
}
.descriptionText{
Padding-left: 25px !important;
Border-left: 10px solid #fafafa;
}
/*
li span {
display: inline-flex;
}
.item span {
width: 100px;
margin-left: 1em;
white-space: nowrap;
}
.item span div {
overflow: hidden;
text-overflow: ellipsis;
}*/

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,113 @@
<!DOCTYPE html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html lang="en-gb" dir="ltr" vocab="http://schema.org/">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OpenAIRE - Forgot password</title>
<script src="./js/jquery.js"></script>
<script src="./js/uikit.js"></script>
<script src="./js/validation.js"></script>
<link rel="stylesheet" style="text/css" href="./css/theme.css">
<link rel="stylesheet" style="text/css" href="./css/custom.css">
<link rel="stylesheet" style="text/css" href="./css/aai-custom.css">
</head>
<body class="" style="">
<div class="uk-offcanvas-content uk-height-viewport">
<!-- MENU STARTS HERE -->
<!-- MAIN MENU STARTS HERE -->
<div class="tm-header tm-header-transparent" uk-header="">
<div class="uk-container uk-container-expand">
<nav class="uk-navbar" uk-navbar="{&quot;align&quot;:&quot;left&quot;}">
<div class="uk-navbar-center">
<div class="uk-logo uk-navbar-item">
<img alt="OpenAIRE" class="uk-responsive-height" src="./images/Logo_Horizontal.png">
</div>
</div>
</nav>
</div>
</div>
<!-- MENU ENDS HERE -->
<!-- CONTENT STARTS HERE -->
<div class="first_page_section uk-section-default uk-section uk-padding-remove-vertical">
<div class="first_page_banner_headline uk-grid-collapse uk-flex-middle uk-margin-remove-vertical uk-grid" uk-grid="">
</div>
</div>
<div class=" uk-section uk-margin-small-top tm-middle custom-main-content" id="tm-main">
<div class="uk-container uk-container-small uk-margin-medium-top uk-margin-small-bottom uk-text-center">
<h2 class="uk-h2 uk-margin-small-bottom">Forgot Password</h2>
<div uk-grid="" class="uk-grid uk-grid-stack">
<div class="tm-main uk-width-1-2@s uk-width-1-1@m uk-width-1-1@l uk-row-first uk-first-column uk-align-center">
<div class="uk-grid ">
<!-- CENTER SIDE -->
<div class="uk-width-1-1@m uk-width-1-1@s uk-text-center">
<!-- <h3 class="uk-h3">Create an account</h3> -->
<div class="middle-box text-center loginscreen animated fadeInDown ">
<p>Please enter the email address for your account. A verification code will be sent to you. Once you have received the verification code, you will be able to choose a new password for your account.</p>
<div class="uk-width-1-3@m uk-align-center">
<!-- REGISTER FORM -->
<div id="registerForm">
<form action="forgotPassword" method="POST" role="form" class="m-t" id="register_form">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
<div class="alert alert-success" aria-hidden="true" style="display: none;"></div>
<div class="alert alert-danger" aria-hidden="true" style="display: none;"></div>
<div class="form-group">
<span id="server_error" class="uk-text-danger uk-text-small uk-float-left">${message}</span>
<c:remove var="message" scope="session" />
<span class="msg_email_error uk-text-danger uk-text-small uk-float-left" style="display:none">Please enter your email.</span>
<span class="msg_email_validation_error uk-text-danger uk-text-small uk-float-left" style="display:none">Please enter a valid email.</span>
<input id="email" name="email" type="text" placeholder="Email" class="form-control"></div>
<div class="uk-margin uk-grid-small uk-child-width-auto uk-grid uk-text-left uk-grid-stack" uk-grid="">
<div class="uk-width-1-1 uk-grid-margin uk-first-column">RECAPTHA I AM NOT A ROBOT THING GOES HERE</div>
<div class="uk-width-1-1 uk-grid-margin uk-first-column">
<button type="submit" class="uk-button uk-button-primary" onclick="return validateForm();">Submit</button>
</div>
</div>
</form>
</div>
<script>
$("#email").focusin(function() {
$(this).removeClass('aai-form-danger');
$(".msg_email_error").fadeOut();
$(".msg_email_validation_error").fadeOut();
$("#server_error").fadeOut();
});
</script>
<!-- END OF REGISTER FORM -->
</div>
</ul>
</div>
</div>
<!-- END OF CENTER SIDE -->
</div>
</div>
</div>
</div>
</div>
<!-- CONTENT ENDS HERE -->
<!-- FOOTER STARTS HERE-->
<div class="custom-footer" style="z-index: 200;">
<div class="uk-section-primary uk-section uk-section-small">
<div class="uk-container">
<div class="uk-grid-margin uk-grid uk-grid-stack" uk-grid="">
<div class="uk-width-1-1@m uk-first-column">
<div class="uk-margin uk-margin-remove-top uk-margin-remove-bottom uk-text-center">
<img alt="OpenAIRE" class="el-image" src="./images/Logo_Horizontal_white_small.png">
</div>
<div class="footer-license uk-margin uk-margin-remove-bottom uk-text-center uk-text-lead">
<div><a href="http://creativecommons.org/licenses/by/4.0/" target="_blank" rel="license"><img alt="Creative" src="./images/80x15.png" style="height: auto; max-width: 100%; vertical-align: middle;"></a>&nbsp;UNLESS OTHERWISE INDICATED, ALL MATERIALS CREATED BY THE OPENAIRE CONSORTIUM ARE LICENSED UNDER A&nbsp;<a href="http://creativecommons.org/licenses/by/4.0/" rel="license">CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE</a>.</div>
<div>OPENAIRE IS POWERED BY&nbsp;<a href="http://www.d-net.research-infrastructures.eu/">D-NET</a>.</div>
</div>
<div class="uk-margin uk-margin-remove-top uk-margin-remove-bottom uk-text-right">
<a class="uk-totop uk-icon" href="#" uk-scroll="" uk-totop="">
</a>
</div>
</div>
</div>
</div>
</div>
</div> <!-- FOOTER ENDS HERE -->
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

5
src/main/webapp/js/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,171 @@
function validateForm() {
var email = $("#email").val();
var email_conf = $("#email_conf").val();
var password = $("#password").val();
var password_conf = $("#password_conf").val();
var isValidEmail = validateEmail(email);
var hasError = false;
var isEmailFilled = false;
var isPasswordFilled = false;
// Check if first name is filled
if($("#first_name").val() != undefined) {
if($.trim($("#first_name").val()).length <= 0) {
$("#first_name").addClass('uk-input aai-form-danger');
$(".msg_first_name_error").show();
} else {
$(".msg_first_name_error").hide();
$("#first_name").removeClass('aai-form-danger');
}
}
// Check if last name is filled
if($("#last_name").val() != undefined) {
if($.trim($("#last_name").val()).length <= 0) {
$("#last_name").addClass('uk-input aai-form-danger');
$(".msg_last_name_error").show();
} else {
$(".msg_last_name_error").hide();
$("#last_name").removeClass('aai-form-danger');
}
}
// Check if organization is filled
if($("#organization").val() != undefined) {
if($.trim($("#organization").val()).length <= 0) {
$("#organization").addClass('uk-input aai-form-danger');
$(".msg_organization_error").show();
} else {
$(".msg_organization_error").hide();
$("#organization").removeClass('aai-form-danger');
}
}
// Check if username is filled
if($("#username").val() != undefined) {
if($.trim($("#username").val()).length <= 0) {
$("#username").addClass('uk-input aai-form-danger');
$(".msg_username_error").show();
hasError = true;
} else {
$(".msg_username_error").hide();
$("#username").removeClass('aai-form-danger');
}
}
if($("#verification_code").val() != undefined) {
if($.trim($("#verification_code").val()).length <= 0) {
$("#username").addClass('uk-input aai-form-danger');
$(".msg_verification_code_error").show();
hasError = true;
} else {
$(".msg_verification_code_error").hide();
$("#verification_code").removeClass('aai-form-danger');
}
}
// Check if email is filled
if($("#email").val() != undefined) {
if($.trim($("#email").val()).length <= 0) {
$("#email").addClass('uk-input aai-form-danger');
$(".msg_email_error").show();
hasError = true;
} else {
isEmailFilled = true;
$(".msg_email_error").hide();
$("#email").removeClass('aai-form-danger');
}
}
// If email is filled
if (isEmailFilled) {
// Check if email is valid
if (!isValidEmail) {
$("#email").addClass('uk-input aai-form-danger');
$(".msg_email_validation_error").show();
hasError = true;
} else {
$(".msg_email_validation_error").hide();
$("#email").removeClass('aai-form-danger');
}
if ($("#email_conf").val() != undefined) {
// Check if emails match
if (isValidEmail && !confirm(email, email_conf)) {
$("#email").addClass('uk-input aai-form-danger');
$("#email_conf").addClass('uk-input aai-form-danger');
$(".msg_email_conf_error").show();
hasError = true;
} else {
$(".msg_email_conf_error").hide();
$("#email").removeClass('aai-form-danger');
$("#email_conf").removeClass('aai-form-danger');
}
}
}
// Check if password is filled
if($("#password").val() != undefined) {
if($.trim($("#password").val()).length <= 0) {
$("#password").addClass('uk-input aai-form-danger');
$(".msg_password_error").show();
} else {
isPasswordFilled = true;
$(".msg_password_error").hide();
$("#password").removeClass('aai-form-danger');
$("#password_conf").removeClass('aai-form-danger');
}
if(isPasswordFilled) {
// Check if passwords match
if (!confirm(password, password_conf)) {
$("#password").addClass('uk-input aai-form-danger');
$("#password_conf").addClass('uk-input aai-form-danger');
$(".msg_pass_conf_error").show();
hasError = true;
} else {
$(".msg_pass_conf_error").hide();
}
}
}
return !hasError;
}
function validateEmail(email) {
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
function confirm(first, second) {
if (first == second)
return true;
else
return false;
}
function loginForm(){
// Check if username is filled
if($.trim($("#login_username").val()).length <= 0) {
$("#login_username").addClass('uk-input aai-form-danger');
$(".msg_login_username_error").show();
} else {
$(".msg_login_username_error").hide();
$("#login_username").removeClass('aai-form-danger');
}
// Check if password is filled
if($.trim($("#login_password").val()).length <= 0) {
$("#login_password").addClass('uk-input aai-form-danger');
$(".msg_login_password_error").show();
} else {
isPasswordFilled = true;
$(".msg_login_password_error").hide();
$("#login_password").removeClass('aai-form-danger');
}
}

View File

@ -0,0 +1,113 @@
<!DOCTYPE html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html lang="en-gb" dir="ltr" vocab="http://schema.org/">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href=".">
<title>OpenAIRE - Username Reminder</title>
<script src="./js/jquery.js"></script>
<script src="./js/uikit.js"></script>
<script src="./js/validation.js"></script>
<link rel="stylesheet" style="text/css" href="./css/theme.css">
<link rel="stylesheet" style="text/css" href="./css/custom.css">
<link rel="stylesheet" style="text/css" href="./css/aai-custom.css"></head>
<body class="" style="">
<div class="uk-offcanvas-content uk-height-viewport">
<!-- MENU STARTS HERE -->
<!-- MAIN MENU STARTS HERE -->
<div class="tm-header tm-header-transparent" uk-header="">
<div class="uk-container uk-container-expand">
<nav class="uk-navbar" uk-navbar="{&quot;align&quot;:&quot;left&quot;}">
<div class="uk-navbar-center">
<div class="uk-logo uk-navbar-item">
<img alt="OpenAIRE" class="uk-responsive-height" src="./images/Logo_Horizontal.png">
</div>
</div>
</nav>
</div>
</div>
<!-- MENU ENDS HERE -->
<!-- CONTENT STARTS HERE -->
<div class="first_page_section uk-section-default uk-section uk-padding-remove-vertical">
<div class="first_page_banner_headline uk-grid-collapse uk-flex-middle uk-margin-remove-vertical uk-grid" uk-grid="">
</div>
</div>
<div class=" uk-section uk-margin-small-top tm-middle custom-main-content" id="tm-main">
<div class="uk-container uk-container-small uk-margin-medium-top uk-margin-small-bottom uk-text-center">
<h2 class="uk-h2 uk-margin-small-bottom">Forgot usernmame</h2>
<div uk-grid="" class="uk-grid uk-grid-stack">
<div class="tm-main uk-width-1-2@s uk-width-1-1@m uk-width-1-1@l uk-row-first uk-first-column uk-align-center">
<div class="uk-grid ">
<!-- CENTER SIDE -->
<div class="uk-width-1-1@m uk-width-1-1@s uk-text-center">
<!-- <h3 class="uk-h3">Forgot usernmame</h3> -->
<div class="middle-box text-left loginscreen animated fadeInDown ">
<p>Please enter the email address associated with your User account. Your username will be emailed to the email address on file.</p>
<div class="uk-width-1-3@m uk-align-center">
<!-- REGISTER FORM -->
<div id="registerForm">
<form action="remindUsername" method="POST" role="form" class="m-t" id="register_form">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
<div class="alert alert-success" aria-hidden="true" style="display: none;"></div>
<div class="alert alert-danger" aria-hidden="true" style="display: none;"></div>
<div class="form-group">
<span id="server_error" class="uk-text-danger uk-text-small uk-float-left">${message}</span>
<c:remove var="message" scope="session" />
<span class="msg_email_error uk-text-danger uk-text-small uk-float-left" style="display:none">Please enter your email.</span>
<span class="msg_email_validation_error uk-text-danger uk-text-small uk-float-left" style="display:none">Please enter a valid email.</span>
<input id="email" name="email" type="text" placeholder="Email" class="form-control"></div>
<div class="uk-margin uk-grid-small uk-child-width-auto uk-grid uk-text-left uk-grid-stack" uk-grid="">
<div class="uk-width-1-1 uk-grid-margin uk-first-column">RECAPTHA I AM NOT A ROBOT THING GOES HERE</div>
<div class="uk-width-1-1 uk-grid-margin uk-first-column">
<button type="submit" class="uk-button uk-button-primary" onclick="return validateForm();">Submit</button>
</div>
</div>
</form>
</div>
<script>
$("#email").focusin(function() {
$(this).removeClass('aai-form-danger');
$("#server_error").fadeOut();
$(".msg_email_error").fadeOut();
$(".msg_email_validation_error").fadeOut();
});
</script>
<!-- END OF REGISTER FORM -->
</div>
</ul>
</div>
</div>
<!-- END OF CENTER SIDE -->
</div>
</div>
</div>
</div>
</div>
<!-- CONTENT ENDS HERE -->
<!-- FOOTER STARTS HERE-->
<div class="custom-footer" style="z-index: 200;">
<div class="uk-section-primary uk-section uk-section-small">
<div class="uk-container">
<div class="uk-grid-margin uk-grid uk-grid-stack" uk-grid="">
<div class="uk-width-1-1@m uk-first-column">
<div class="uk-margin uk-margin-remove-top uk-margin-remove-bottom uk-text-center">
<img alt="OpenAIRE" class="el-image" src="./images/Logo_Horizontal_white_small.png">
</div>
<div class="footer-license uk-margin uk-margin-remove-bottom uk-text-center uk-text-lead">
<div><a href="http://creativecommons.org/licenses/by/4.0/" target="_blank" rel="license"><img alt="Creative" src="./images/80x15.png" style="height: auto; max-width: 100%; vertical-align: middle;"></a>&nbsp;UNLESS OTHERWISE INDICATED, ALL MATERIALS CREATED BY THE OPENAIRE CONSORTIUM ARE LICENSED UNDER A&nbsp;<a href="http://creativecommons.org/licenses/by/4.0/" rel="license">CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE</a>.</div>
<div>OPENAIRE IS POWERED BY&nbsp;<a href="http://www.d-net.research-infrastructures.eu/">D-NET</a>.</div>
</div>
<div class="uk-margin uk-margin-remove-top uk-margin-remove-bottom uk-text-right">
<a class="uk-totop uk-icon" href="#" uk-scroll="" uk-totop="">
</a>
</div>
</div>
</div>
</div>
</div>
</div> <!-- FOOTER ENDS HERE -->
</div>
</body>
</html>

View File

@ -0,0 +1,114 @@
<!DOCTYPE html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html lang="en-gb" dir="ltr" vocab="http://schema.org/">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href=".">
<title>OpenAIRE - Enter new password</title>
<script src="./js/jquery.js"></script>
<script src="./js/uikit.js"></script>
<script src="./js/validation.js"></script>
<link rel="stylesheet" style="text/css" href="./css/theme.css">
<link rel="stylesheet" style="text/css" href="./css/custom.css">
<link rel="stylesheet" style="text/css" href="./css/aai-custom.css">
</head>
<body class="" style="">
<div class="uk-offcanvas-content uk-height-viewport">
<!-- MENU STARTS HERE -->
<!-- MAIN MENU STARTS HERE -->
<div class="tm-header tm-header-transparent" uk-header="">
<div class="uk-container uk-container-expand">
<nav class="uk-navbar" uk-navbar="{&quot;align&quot;:&quot;left&quot;}">
<div class="uk-navbar-center">
<div class="uk-logo uk-navbar-item">
<img alt="OpenAIRE" class="uk-responsive-height" src="./images/Logo_Horizontal.png">
</div>
</div>
</nav>
</div>
</div>
<!-- MENU ENDS HERE -->
<!-- CONTENT STARTS HERE -->
<div class="first_page_section uk-section-default uk-section uk-padding-remove-vertical">
<div class="first_page_banner_headline uk-grid-collapse uk-flex-middle uk-margin-remove-vertical uk-grid" uk-grid="">
</div>
</div>
<div class=" uk-section uk-margin-small-top tm-middle custom-main-content" id="tm-main">
<div class="uk-container uk-container-small uk-margin-medium-top uk-margin-small-bottom uk-text-center">
<div uk-grid="" class="uk-grid uk-grid-stack">
<div class="tm-main uk-width-1-2@s uk-width-1-1@m uk-width-1-1@l uk-row-first uk-first-column uk-align-center">
<div class="uk-grid ">
<!-- CENTER SIDE -->
<div class="uk-width-1-1@m uk-width-1-1@s uk-text-center">
<div class="middle-box text-center loginscreen animated fadeInDown ">
<p>To complete the password reset process, please enter a new password.</p>
<div class="uk-width-1-3@m uk-align-center">
<!-- REGISTER FORM -->
<div id="registerForm">
<form target="changePassword" method="POST" role="form" class="m-t" id="register_form" >
<div class="alert alert-success" aria-hidden="true" style="display: none;"></div>
<div class="alert alert-danger" aria-hidden="true" style="display: none;"></div>
<div class="form-group">
<span class="msg_password_error uk-text-danger uk-text-small uk-float-left" style="display:none">Please enter your password.</span>
<span class="msg_pass_conf_error uk-text-danger uk-text-small uk-float-left" style="display:none">These passwords don't match.</span>
<input id="password" name="password" type="password" placeholder="Password" class="form-control"></div>
<div class="form-group">
<input id="password_conf" name="password_conf" type="password" placeholder="Confirm password" class="form-control"></div>
<div class="uk-margin uk-grid-small uk-child-width-auto uk-grid uk-text-left uk-grid-stack" uk-grid="">
<div class="uk-width-1-1 uk-grid-margin uk-first-column">
<button type="button" class="uk-button uk-button-primary" onclick="return validateForm();">Submit</button>
</div>
</div>
</form>
</div>
<!-- END OF REGISTER FORM -->
<script>
$("#password").focusin(function() {
$(this).removeClass('aai-form-danger');
$(".msg_password_error").fadeOut();
$(".msg_pass_conf_error").fadeOut();
});
$("#password_conf").focusin(function() {
$(this).removeClass('aai-form-danger');
$(".msg_pass_conf_error").fadeOut();
});
</script>
</div>
</ul>
</div>
</div>
<!-- END OF CENTER SIDE -->
</div>
</div>
</div>
</div>
</div>
<!-- CONTENT ENDS HERE -->
<!-- FOOTER STARTS HERE-->
<div class="custom-footer" style="z-index: 200;">
<div class="uk-section-primary uk-section uk-section-small">
<div class="uk-container">
<div class="uk-grid-margin uk-grid uk-grid-stack" uk-grid="">
<div class="uk-width-1-1@m uk-first-column">
<div class="uk-margin uk-margin-remove-top uk-margin-remove-bottom uk-text-center">
<img alt="OpenAIRE" class="el-image" src="./images/Logo_Horizontal_white_small.png">
</div>
<div class="footer-license uk-margin uk-margin-remove-bottom uk-text-center uk-text-lead">
<div><a href="http://creativecommons.org/licenses/by/4.0/" target="_blank" rel="license"><img alt="Creative" src="./images/80x15.png" style="height: auto; max-width: 100%; vertical-align: middle;"></a>&nbsp;UNLESS OTHERWISE INDICATED, ALL MATERIALS CREATED BY THE OPENAIRE CONSORTIUM ARE LICENSED UNDER A&nbsp;<a href="http://creativecommons.org/licenses/by/4.0/" rel="license">CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE</a>.</div>
<div>OPENAIRE IS POWERED BY&nbsp;<a href="http://www.d-net.research-infrastructures.eu/">D-NET</a>.</div>
</div>
<div class="uk-margin uk-margin-remove-top uk-margin-remove-bottom uk-text-right">
<a class="uk-totop uk-icon" href="#" uk-scroll="" uk-totop="">
</a>
</div>
</div>
</div>
</div>
</div>
</div> <!-- FOOTER ENDS HERE -->
</div>
</body>
</html>

115
src/main/webapp/verify.jsp Normal file
View File

@ -0,0 +1,115 @@
<!DOCTYPE html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html lang="en-gb" dir="ltr" vocab="http://schema.org/">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href=".">
<title>OpenAIRE - Forgot password, verification code</title>
<script src="./js/jquery.js"></script>
<script src="./js/uikit.js"></script>
<script src="./js/validation.js"></script>
<link rel="stylesheet" style="text/css" href="./css/theme.css">
<link rel="stylesheet" style="text/css" href="./css/custom.css">
<link rel="stylesheet" style="text/css" href="./css/aai-custom.css">
</head>
<body class="" style="">
<div class="uk-offcanvas-content uk-height-viewport">
<!-- MENU STARTS HERE -->
<!-- MAIN MENU STARTS HERE -->
<div class="tm-header tm-header-transparent" uk-header="">
<div class="uk-container uk-container-expand">
<nav class="uk-navbar" uk-navbar="{&quot;align&quot;:&quot;left&quot;}">
<div class="uk-navbar-center">
<div class="uk-logo uk-navbar-item">
<img alt="OpenAIRE" class="uk-responsive-height" src="./images/Logo_Horizontal.png">
</div>
</div>
</nav>
</div>
</div>
<!-- MENU ENDS HERE -->
<!-- CONTENT STARTS HERE -->
<div class="first_page_section uk-section-default uk-section uk-padding-remove-vertical">
<div class="first_page_banner_headline uk-grid-collapse uk-flex-middle uk-margin-remove-vertical uk-grid" uk-grid="">
</div>
</div>
<div class=" uk-section uk-margin-small-top tm-middle custom-main-content" id="tm-main">
<div class="uk-container uk-container-small uk-margin-medium-top uk-margin-small-bottom uk-text-center">
<div uk-grid="" class="uk-grid uk-grid-stack">
<div class="tm-main uk-width-1-2@s uk-width-1-1@m uk-width-1-1@l uk-row-first uk-first-column uk-align-center">
<div class="uk-grid ">
<!-- CENTER SIDE -->
<div class="uk-width-1-1@m uk-width-1-1@s uk-text-center">
<div class="middle-box text-center loginscreen animated fadeInDown ">
<p>An email has been sent to your email address. The email contains a verification code, please paste the verification code in the field below to prove that you are the owner of this account.</p>
<div class="uk-width-1-3@m uk-align-center">
<!-- Validate form -->
<div id="registerForm">
<form action="verifyCode" method="POST" role="form" class="m-t" id="register_form">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
<div class="alert alert-success" aria-hidden="true" style="display: none;"></div>
<div class="alert alert-danger" aria-hidden="true" style="display: none;"></div>
<div class="form-group">
<span class="msg_username_error uk-text-danger uk-text-small uk-float-left" style="display:none">Please enter your username.</span>
<input id="username" name="username" type="text" placeholder="Username" class="form-control"></div>
<div class="form-group">
<span class="msg_verification_code_error uk-text-danger uk-text-small uk-float-left" style="display:none">Please enter your verification code.</span>
<input id="verification_code" name="verification_code" type="text" placeholder="Verification Code" class="form-control"></div>
<div class="uk-margin uk-grid-small uk-child-width-auto uk-grid uk-text-left uk-grid-stack" uk-grid="">
<div class="uk-width-1-1 uk-grid-margin uk-first-column">
<button type="submit" class="uk-button uk-button-primary" onclick="return validateForm();">Submit</button>
</div>
</div>
</form>
</div>
<!-- END OF REGISTER FORM -->
<script>
$("#username").focusin(function() {
$(this).removeClass('aai-form-danger');
$(".msg_username_error").fadeOut();
});
$("#verification_code").focusin(function() {
$(this).removeClass('aai-form-danger');
$(".msg_verification_code_error").fadeOut();
});
</script>
</div>
</ul>
</div>
</div>
<!-- END OF CENTER SIDE -->
</div>
</div>
</div>
</div>
</div>
<!-- CONTENT ENDS HERE -->
<!-- FOOTER STARTS HERE-->
<div class="custom-footer" style="z-index: 200;">
<div class="uk-section-primary uk-section uk-section-small">
<div class="uk-container">
<div class="uk-grid-margin uk-grid uk-grid-stack" uk-grid="">
<div class="uk-width-1-1@m uk-first-column">
<div class="uk-margin uk-margin-remove-top uk-margin-remove-bottom uk-text-center">
<img alt="OpenAIRE" class="el-image" src="./images/Logo_Horizontal_white_small.png">
</div>
<div class="footer-license uk-margin uk-margin-remove-bottom uk-text-center uk-text-lead">
<div><a href="http://creativecommons.org/licenses/by/4.0/" target="_blank" rel="license"><img alt="Creative" src="./images/80x15.png" style="height: auto; max-width: 100%; vertical-align: middle;"></a>&nbsp;UNLESS OTHERWISE INDICATED, ALL MATERIALS CREATED BY THE OPENAIRE CONSORTIUM ARE LICENSED UNDER A&nbsp;<a href="http://creativecommons.org/licenses/by/4.0/" rel="license">CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE</a>.</div>
<div>OPENAIRE IS POWERED BY&nbsp;<a href="http://www.d-net.research-infrastructures.eu/">D-NET</a>.</div>
</div>
<div class="uk-margin uk-margin-remove-top uk-margin-remove-bottom uk-text-right">
<a class="uk-totop uk-icon" href="#" uk-scroll="" uk-totop="">
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- FOOTER ENDS HERE -->
</div>
</body>
</html>