dnet-openaire-users/src/main/webapp/register.jsp

360 lines
26 KiB
Plaintext

<%--
Created by IntelliJ IDEA.
User: sofia
Date: 19/10/2017
Time: 4:30 μμ
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!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 - Register</title>
<script src="./js/jquery.js"></script>
<script src="./js/uikit.min.js"></script>
<script src="./js/validation.js"></script>
<script src="./js/uikit-icons-max.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">
<link rel="icon" type="image/png" sizes="32x32" href="images/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="images/favicon//favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="images/favicon/favicon-16x16.png">
<link href="images/favicon/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
<script src='https://www.google.com/recaptcha/api.js'></script>
</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 tm-middle custom-main-content" id="tm-main">
<div class="uk-container uk-container-small uk-margin-small-bottom uk-text-center">
<h2 class="uk-h2 uk-margin-small-bottom">Create new OpenAIRE account</h2>
<%--<div class="uk-text-meta uk-margin-large-bottom">Use the same credentials for all our services</div>--%>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first uk-first-column">
<div class="uk-grid ">
<!-- CENTER SIDE -->
<div class="uk-width-1-1@m uk-width-1-1@s uk-text-center">
<h3 class="uk-h4">Create an account</h3>
<div class="middle-box text-center loginscreen animated fadeInDown ">
<div class="uk-width-1-3@m uk-align-center">
<!-- REGISTER FORM -->
<div id="registerForm">
<form action="register" 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>
<span id="server_error" class="uk-text-danger uk-text-small uk-float-left">${message}</span>
<c:remove var="message" scope="session" />
<div class="form-group">
<span class="msg_first_name_error uk-text-danger uk-text-small uk-float-left" style="display:none;">Please enter your first name.</span>
<input id="first_name" name="first_name" type="text" placeholder="First name (*)" class="form-control" value=${first_name}></div>
<c:remove var="msg_first_name_error_display" scope="session" />
<c:remove var="first_name" scope="session" />
<div class="form-group">
<span class="msg_last_name_error uk-text-danger uk-text-small uk-float-left" style="display:none;">Please enter your last name.</span>
<input id="last_name" name="last_name" type="text" placeholder="Last name (*)" class="form-control" value=${last_name}></div>
<c:remove var="msg_last_name_error_display" scope="session" />
<c:remove var="last_name" scope="session" />
<div class="form-group">
<input id="organization" name="organization" type="text" placeholder="Affiliation / Organization:" class="form-control" value=${organization}></div>
<c:remove var="organization" scope="session" />
<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>
<span class="msg_username_min_lenght uk-text-danger uk-text-small uk-float-left" style="display:none">Minimum username length 5 characters.</span>
<span class="msg_username_max_lenght uk-text-danger uk-text-small uk-float-left" style="display:none">Maximum username length 150 characters.</span>
<span class="msg_username_start uk-text-danger uk-text-small uk-float-left" style="display:none">The username must start with letter or digit.</span>
<span class="msg_username_allowed_characters uk-text-danger uk-text-small uk-float-left" style="display:none">You can use letters, numbers, underscores, hyphens and periods.</span>
<span id="username_server_error" class="uk-text-danger uk-text-small uk-float-left">${username_message}</span>
<span id="username_allowed_chars_server_error" class="uk-text-danger uk-text-small uk-float-left">${username_allowed_chars_message}</span>
<span id="username_first_char_server_error" class="uk-text-danger uk-text-small uk-float-left">${username_first_char_message}</span>
<c:remove var="username_message" scope="session" />
<c:remove var="username_allowed_chars_message" scope="session" />
<c:remove var="username_first_char_message" scope="session" />
<input id="username" name="username" type="text" placeholder="Username (*)" class="form-control" value=${username}></div>
<c:remove var="username" scope="session" />
<div class="form-group">
<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>
<span class="msg_email_conf_error uk-text-danger uk-text-small uk-float-left" style="display:none;">These emails don't match.</span>
<span id="email_server_error" class="uk-text-danger uk-text-small uk-float-left">${email_message}</span>
<c:remove var="msg_email_conf_error_display" scope="session" />
<c:remove var="msg_email_validation_error_display" scope="session" />
<c:remove var="email_message" scope="session" />
<input id="email" name="email" type="text" placeholder="Email (*)" class="form-control" value=${email}></div>
<c:remove var="email" scope="session" />
<c:remove var="msg_email_error_display" scope="session" />
<div class="form-group">
<input id="email_conf" name="email_conf" type="text" placeholder="Confirm email (*)" class="form-control" value=${email_conf}></div>
<c:remove var="email_conf" scope="session" />
<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>
<p>
<span class="msg_please_add uk-text-danger uk-text-small uk-float-left" style="display:none">Please add: &nbsp</span></p>
<span class="msg_lowercase_letter uk-text-danger uk-text-small uk-float-left" style="display:none">A lowercase letter. &nbsp</span>
<span class="msg_capital_letter uk-text-danger uk-text-small uk-float-left" style="display:none">A capital (uppercase) letter. &nbsp </span>
<span class="msg_number uk-text-danger uk-text-small uk-float-left" style="display:none">A number. &nbsp</span>
<span class="msg_lenght uk-text-danger uk-text-small uk-float-left" style="display:none">Minimum 6 characters. &nbsp</span>
<p><span class="msg_whitespace uk-text-danger uk-text-small uk-float-left" style="display:none">No white space allowed. &nbsp</span></p>
<span class="msg_invalid_password uk-text-danger uk-text-small uk-float-left" style="display:none;">The password must
contain a lowercase letter, a capital (uppercase) letter, a number and must be at least 6 characters long. White space character is not allowed.</span>
<input id="password" name="password" type="password" placeholder="Password" class="form-control"></div>
<c:remove var="msg_pass_conf_error_display" scope="session" />
<c:remove var="msg_password_error_display" scope="session" />
<c:remove var="msg_invalid_password_display" scope="session" />
<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-text-meta uk-text-danger uk-first-column">(*) Required fields</div>
<span class="uk-text-danger uk-text-small recaptcha_error" style="display:none;">You missed the reCAPTCHA validation!</span>
<c:remove var="recaptcha_error_display" scope="session" />
<div class="g-recaptcha" data-sitekey=${applicationScope.sitekey}></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();">Register</button>
</div>
</div>
</form>
</div>
<!-- END OF REGISTER FORM -->
<script>
var myInput = document.getElementById("password");
var usernameInput = document.getElementById("username");
//var myEmailInput = document.getElementById("email");
$("#password").focusin(function () {
$(".msg_invalid_password").fadeOut();
});
// When the user starts to type something inside the password field
myInput.onkeyup = function() {
var space = /[\s]+/g;
if (myInput.value.match(space)) {
$(".msg_whitespace").fadeIn();
} else {
$(".msg_whitespace").fadeOut();
}
// Validate lowercase letters
var lowerCaseLetters = /[a-z]/g;
if (myInput.value.match(lowerCaseLetters)) {
$(".msg_lowercase_letter").fadeOut();
} else {
$(".msg_lowercase_letter").fadeIn();
}
// Validate capital letters
var upperCaseLetters = /[A-Z]/g;
if (myInput.value.match(upperCaseLetters)) {
$(".msg_capital_letter").fadeOut();
} else {
$(".msg_capital_letter").fadeIn();
}
// Validate numbers
var numbers = /[0-9]/g;
if (myInput.value.match(numbers)) {
$(".msg_number").fadeOut();
} else {
$(".msg_number").fadeIn();
}
// Validate length
if (myInput.value.length >= 6) {
$(".msg_lenght").fadeOut();
} else {
$(".msg_lenght").fadeIn();
}
if(myInput.value.match(lowerCaseLetters) && myInput.value.match(upperCaseLetters)
&& myInput.value.match(numbers) && (myInput.value.length >= 6)){
if($(".msg_please_add").css('display')!='none'){
$(".msg_please_add").fadeOut();
}
} else {
if($(".msg_please_add").css('display')=='none') {
$(".msg_please_add").fadeIn();
}
}
}
usernameInput.onkeyup = function() {
// Validate username minimum length
if (usernameInput.value.length >= 5) {
$(".msg_username_min_lenght").fadeOut();
} else {
$(".msg_username_min_lenght").fadeIn();
}
// Validate username maximum length
if (usernameInput.value.length < 150) {
$(".msg_username_max_lenght").fadeOut();
} else {
$(".msg_username_max_lenght").fadeIn();
}
var allowedChars = /^[a-zA-Z0-9._-]*$/;
if (usernameInput.value.match(allowedChars)) {
$(".msg_username_allowed_characters").fadeOut();
} else {
$(".msg_username_allowed_characters").fadeIn();
}
var startsWith = /^[a-zA-Z0-9].*/;
if (usernameInput.value.match(startsWith)) {
$(".msg_username_start").fadeOut();
} else {
$(".msg_username_start").fadeIn();
}
}
$("#first_name").focusin(function () {
$(this).removeClass('aai-form-danger');
$(".msg_first_name_error").fadeOut();
});
$("#last_name").focusin(function () {
$(this).removeClass('aai-form-danger');
$(".msg_last_name_error").fadeOut();
});
$("#username").focusin(function () {
$(this).removeClass('aai-form-danger');
$(".msg_username_error").fadeOut();
$("#username_server_error").fadeOut();
$("#username_allowed_chars_server_error").fadeOut();
$("#username_first_char_server_error").fadeOut();
});
$("#email").focusin(function () {
$(this).removeClass('aai-form-danger');
$(".msg_email_error").fadeOut();
$(".msg_email_validation_error").fadeOut();
$("#email_server_error").fadeOut();
});
$("#email_conf").focusin(function () {
$(this).removeClass('aai-form-danger');
$(".msg_email_conf_error").fadeOut();
});
$("#password").focusin(function () {
$(this).removeClass('aai-form-danger');
$(".msg_please_add").fadeOut();
$(".msg_password_error").fadeOut();
$(".msg_pass_conf_error").fadeOut();
$(".msg_lowercase_letter").fadeOut();
$(".msg_capital_letter").fadeOut();
$(".msg_number").fadeOut();
$(".msg_lenght").fadeOut();
});
$("#password_conf").focusin(function () {
$(this).removeClass('aai-form-danger');
$(".msg_pass_conf_error").fadeOut();
});
// // Run on page load
// window.onload = function() {
//
//// // If sessionStorage is storing default values (ex. name), exit the function and do not restore data
//// if (sessionStorage.getItem('name') == "name") {
//// return;
//// }
//
// // If values are not blank, restore them to the fields
//
// var first_name = sessionStorage.getItem('first_name');
// if (first_name !== null) $('#first_name').val(first_name);
//
// var last_name = sessionStorage.getItem('last_name');
// if (last_name !== null) $('#last_name').val(last_name);
//
// var organization = sessionStorage.getItem('organization');
// if (organization !== null) $('#organization').val(organization);
//
// var username = sessionStorage.getItem('username');
// if (username !== null) $('#username').val(username);
//
// var email = sessionStorage.getItem('email');
// if (email !== null) $('#email').val(email);
//
// var email_conf= sessionStorage.getItem('email_conf');
// if (email_conf!== null) $('#email_conf').val(email_conf);
//
//
// }
//
// // Before refreshing the page, save the form data to sessionStorage
// window.onbeforeunload = function() {
// sessionStorage.setItem("first_name", $('#first_name').val());
// sessionStorage.setItem("last_name", $('#last_name').val());
// sessionStorage.setItem("organization", $('#organization').val());
// sessionStorage.setItem("username", $('#username').val());
// sessionStorage.setItem("email", $('#email').val());
// sessionStorage.setItem("email_conf", $('#email_conf').val());
// }
</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>
</div>
</body>
</html>