alpha versione complete
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/accept-invite-portlet@160094 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d5aedc3c63
commit
4bf9153c45
|
@ -14,14 +14,16 @@
|
||||||
|
|
||||||
package org.gcube.portlets.user.acceptinvite;
|
package org.gcube.portlets.user.acceptinvite;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.portlet.ActionRequest;
|
|
||||||
import javax.portlet.ActionResponse;
|
|
||||||
import javax.portlet.RenderRequest;
|
import javax.portlet.RenderRequest;
|
||||||
import javax.portlet.RenderResponse;
|
import javax.portlet.RenderResponse;
|
||||||
import javax.portlet.ResourceRequest;
|
import javax.portlet.ResourceRequest;
|
||||||
import javax.portlet.ResourceResponse;
|
import javax.portlet.ResourceResponse;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
|
@ -38,28 +40,28 @@ import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
||||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.portlet.bind.annotation.ActionMapping;
|
|
||||||
import org.springframework.web.portlet.bind.annotation.RenderMapping;
|
import org.springframework.web.portlet.bind.annotation.RenderMapping;
|
||||||
import org.springframework.web.portlet.bind.annotation.ResourceMapping;
|
import org.springframework.web.portlet.bind.annotation.ResourceMapping;
|
||||||
|
|
||||||
import com.liferay.portal.kernel.exception.PortalException;
|
|
||||||
import com.liferay.portal.kernel.exception.SystemException;
|
|
||||||
import com.liferay.portal.kernel.json.JSONArray;
|
|
||||||
import com.liferay.portal.kernel.json.JSONFactoryUtil;
|
|
||||||
import com.liferay.portal.kernel.json.JSONObject;
|
|
||||||
import com.liferay.portal.kernel.log.Log;
|
import com.liferay.portal.kernel.log.Log;
|
||||||
import com.liferay.portal.kernel.log.LogFactoryUtil;
|
import com.liferay.portal.kernel.log.LogFactoryUtil;
|
||||||
import com.liferay.portal.kernel.util.ParamUtil;
|
import com.liferay.portal.kernel.util.ParamUtil;
|
||||||
import com.liferay.portal.model.Group;
|
import com.liferay.portal.model.Group;
|
||||||
|
import com.liferay.portal.model.User;
|
||||||
import com.liferay.portal.service.GroupLocalServiceUtil;
|
import com.liferay.portal.service.GroupLocalServiceUtil;
|
||||||
|
import com.liferay.portal.service.ServiceContext;
|
||||||
|
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||||
import com.liferay.portal.util.PortalUtil;
|
import com.liferay.portal.util.PortalUtil;
|
||||||
|
|
||||||
@Controller(value = "PortletViewController")
|
@Controller(value = "PortletViewController")
|
||||||
@RequestMapping("VIEW")
|
@RequestMapping("VIEW")
|
||||||
public class PortletViewController {
|
public class PortletViewController {
|
||||||
private static Log _log = LogFactoryUtil.getLog(PortletViewController.class);
|
private static Log _log = LogFactoryUtil.getLog(PortletViewController.class);
|
||||||
|
public static final Pattern VALID_EMAIL_ADDRESS_REGEX =
|
||||||
|
Pattern.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE);
|
||||||
|
|
||||||
|
public static final String DEFAULT_COMPANY_WEB_ID = "liferay.com";
|
||||||
|
|
||||||
private static String PAGE_NOT_AUTHORIZED = "not-authorized";
|
private static String PAGE_NOT_AUTHORIZED = "not-authorized";
|
||||||
private static String PAGE_INVITE_NOTFOUND = "invite-notfound";
|
private static String PAGE_INVITE_NOTFOUND = "invite-notfound";
|
||||||
|
@ -69,6 +71,8 @@ public class PortletViewController {
|
||||||
|
|
||||||
public static String INVITE_INSTANCE = "inviteInstance";
|
public static String INVITE_INSTANCE = "inviteInstance";
|
||||||
|
|
||||||
|
private static String MODEL_ATTR = "theModel";
|
||||||
|
|
||||||
private static DatabookStore store;
|
private static DatabookStore store;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,44 +139,122 @@ public class PortletViewController {
|
||||||
model.addAttribute("groupId", site.getGroupId());
|
model.addAttribute("groupId", site.getGroupId());
|
||||||
model.addAttribute("landingPage", PortalContext.getConfiguration().getSiteLandingPagePath(httpReq));
|
model.addAttribute("landingPage", PortalContext.getConfiguration().getSiteLandingPagePath(httpReq));
|
||||||
|
|
||||||
|
HttpSession session = httpReq.getSession();
|
||||||
|
session.setAttribute(MODEL_ATTR, model);
|
||||||
|
|
||||||
return PAGE_INVITE_PROCESS;
|
return PAGE_INVITE_PROCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ResourceMapping(value="findState")
|
|
||||||
public void findStateForCountry(ResourceRequest request, ResourceResponse response) throws IOException {
|
|
||||||
String countryName = ParamUtil.getString(request, "countryName");
|
|
||||||
_log.info("countryName=" + countryName);
|
|
||||||
JSONArray stateArray = JSONFactoryUtil.createJSONArray();
|
|
||||||
JSONObject stateObject,stateObject2;
|
|
||||||
if(countryName.equalsIgnoreCase("india"))
|
|
||||||
{
|
|
||||||
stateObject = JSONFactoryUtil.createJSONObject();
|
|
||||||
stateObject.put("stateId", "1");
|
|
||||||
stateObject.put("name", "Delhi");
|
|
||||||
|
|
||||||
stateObject2 = JSONFactoryUtil.createJSONObject();
|
@ResourceMapping(value="createAccount")
|
||||||
stateObject2.put("stateId", "2");
|
public void createAccountForUser(ResourceRequest request, ResourceResponse response) throws IOException {
|
||||||
stateObject2.put("name", "Gujrat");
|
String email = ParamUtil.getString(request, "email");
|
||||||
|
String firstName = ParamUtil.getString(request, "firstname");
|
||||||
|
String lastName = ParamUtil.getString(request, "lastname");
|
||||||
|
String password = ParamUtil.getString(request, "password");
|
||||||
|
String repassword = ParamUtil.getString(request, "repassword");
|
||||||
|
_log.info("firstName=" + firstName);
|
||||||
|
_log.info("lastName=" + lastName);
|
||||||
|
_log.info("email=" + email);
|
||||||
|
_log.info("password=" + password);
|
||||||
|
_log.info("repassword=" + repassword);
|
||||||
|
|
||||||
|
|
||||||
|
HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(request));
|
||||||
|
Model model = (Model) httpReq.getSession().getAttribute(MODEL_ATTR);
|
||||||
|
Invite invite = (Invite) model.asMap().get(INVITE_INSTANCE);
|
||||||
|
|
||||||
|
if (invite.getInvitedEmail().compareTo(email) != 0) {
|
||||||
|
response.getWriter().println("The email address invited does not match or is empty.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
|
|
||||||
stateObject = JSONFactoryUtil.createJSONObject();
|
//check the fields before creating account
|
||||||
stateObject.put("stateId", "21");
|
if (firstName == null
|
||||||
stateObject.put("name", "LA");
|
|| firstName.equals("")
|
||||||
|
|| lastName == null
|
||||||
stateObject2 = JSONFactoryUtil.createJSONObject();
|
|| lastName.equals("")
|
||||||
stateObject2.put("stateId", "22");
|
|| email.equals("")
|
||||||
stateObject2.put("name", "California");
|
|| password.equals("")
|
||||||
|
|| repassword.equals("")
|
||||||
|
|| password.length() < 8) {
|
||||||
|
response.getWriter().println("Not all the required fields have been filled.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
stateArray.put(stateObject);
|
if (!validate(email)) {
|
||||||
stateArray.put(stateObject2);
|
response.getWriter().println("The email address invited does not look like a valid email address.");
|
||||||
response.getWriter().println(stateArray);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//checking if the user has been already registered or is already in the portal
|
||||||
|
GCubeUser theUser = register(firstName, lastName, email, password);
|
||||||
|
if (theUser != null)
|
||||||
|
response.getWriter().println("OK");
|
||||||
|
else
|
||||||
|
response.getWriter().println("Something went wrong when creating your account during server communication, please check your connection.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean validate(String emailStr) {
|
||||||
|
Matcher matcher = VALID_EMAIL_ADDRESS_REGEX .matcher(emailStr);
|
||||||
|
return matcher.find();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
private GCubeUser register(String firstName, String lastName, String email, String password1) {
|
||||||
|
GCubeUser toReturn = null;
|
||||||
|
try{
|
||||||
|
_log.debug("Trying createuser " + email);
|
||||||
|
Long defaultCompanyId = PortalUtil.getDefaultCompanyId();
|
||||||
|
Long defaultUserId = UserLocalServiceUtil.getDefaultUserId(defaultCompanyId);
|
||||||
|
|
||||||
|
boolean autoPassword = false;
|
||||||
|
Locale locale = new Locale("en_US");
|
||||||
|
int prefixId = 0;
|
||||||
|
int suffixId = 0;
|
||||||
|
int birthdayMonth = 1;
|
||||||
|
int birthdayDay = 1;
|
||||||
|
int birthdayYear = 1970;
|
||||||
|
String password2 = password1;
|
||||||
|
User added = UserLocalServiceUtil.addUser(
|
||||||
|
defaultUserId,
|
||||||
|
defaultCompanyId,
|
||||||
|
autoPassword,
|
||||||
|
password1,
|
||||||
|
password2,
|
||||||
|
true,
|
||||||
|
"",
|
||||||
|
email,
|
||||||
|
0L,
|
||||||
|
"",
|
||||||
|
locale,
|
||||||
|
firstName,
|
||||||
|
"",
|
||||||
|
lastName,
|
||||||
|
prefixId,
|
||||||
|
suffixId,
|
||||||
|
true,
|
||||||
|
birthdayMonth,
|
||||||
|
birthdayDay,
|
||||||
|
birthdayYear,
|
||||||
|
"",
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
true,
|
||||||
|
new ServiceContext());
|
||||||
|
_log.debug("CreateUser " + lastName + " SUCCESS");
|
||||||
|
UserLocalServiceUtil.updateAgreedToTermsOfUse(added.getUserId(), false);
|
||||||
|
UserLocalServiceUtil.updatePasswordReset(added.getUserId(), false);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(Exception e){
|
||||||
|
// unable to create.. we need to delete it from the list of users
|
||||||
|
_log.error("Unable to create the user " + email + " in liferay.", e);
|
||||||
|
|
||||||
|
}
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -10,173 +10,135 @@
|
||||||
<portlet:defineObjects />
|
<portlet:defineObjects />
|
||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||||
|
|
||||||
<portlet:resourceURL id="findState" var="findState"></portlet:resourceURL>
|
<portlet:resourceURL id="createAccount" var="createAccount"></portlet:resourceURL>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function(){
|
$(document).ready(function() {
|
||||||
|
doCallback = function() {
|
||||||
$( "#createAccountButton" ).click(function() {
|
$('#formCreateAccountWrapper').css("display", "none");// to clear the previous option
|
||||||
var firstnameBox = $.trim( $('#firstname').val() )
|
$('#loadingAjaxCallback').css("display", "block");
|
||||||
if (firstnameBox == "") {
|
$.ajax({
|
||||||
$('#labelFirstName').css("color","red");
|
url : "${createAccount}",
|
||||||
$('#labelFirstName').text("First Name (This field is required)");
|
type : 'POST',
|
||||||
} else {
|
datatype : 'json',
|
||||||
$('#labelFirstName').css("color","#555");
|
data : {
|
||||||
$('#labelFirstName').text("First Name (Required)");
|
email : $("#email").val(),
|
||||||
}
|
firstname : $("#firstname").val(),
|
||||||
var lastnameBox = $.trim( $('#lastname').val() )
|
lastname : $("#lastname").val(),
|
||||||
if (lastnameBox == "") {
|
password : $("#password").val(),
|
||||||
$('#labelLastName').css("color","red");
|
repassword : $("#repassword").val()
|
||||||
$('#labelLastName').text("Last Name (This field is required)");
|
},
|
||||||
} else {
|
success : function(data) {
|
||||||
$('#labelLastName').css("color","#555");
|
$('#loadingAjaxCallback').css("display", "none");
|
||||||
$('#labelLastName').text("Last Name (Required)");
|
if (data == "OK") {
|
||||||
}
|
$('#successDiv').css("display", "block");
|
||||||
|
} else {
|
||||||
var passwd1 = $('#password');
|
$('#errorDiv').css("display", "block");
|
||||||
var labelPwd1 = $('#labelPwd1');
|
$('#errorLabel').text(data);
|
||||||
var passwd2 = $('#repassword');
|
}
|
||||||
var labelPwd2 = $('#labelPwd2');
|
}
|
||||||
|
});
|
||||||
labelPwd1.addClass( passwd1.val().length === 0 ? 'has-error' : 'has-success' );
|
|
||||||
labelPwd2.addClass( passwd2.val().length === 0 ? 'has-error' : 'has-success' );
|
|
||||||
|
|
||||||
var nomatch = $('#labelPasswordDontMatch');
|
|
||||||
|
|
||||||
if (passwd1.val() !== passwd2.val()) {
|
|
||||||
nomatch.css("display","block");
|
|
||||||
nomatch.css("color","red");
|
|
||||||
labelPwd1.addClass( passwd1.val() !== passwd2.val() ? 'has-error' : 'has-success' )
|
|
||||||
.removeClass( passwd1.val() === passwd2.val() ? 'has-error' : 'has-success' );
|
|
||||||
labelPwd2.addClass( passwd1.val() !== passwd2.val() ? 'has-error' : 'has-success' )
|
|
||||||
.removeClass( passwd1.val() === passwd2.val() ? 'has-error' : 'has-success' );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
nomatch.css("display","none");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var shortpwd = $('#labelPasswordTooShort');
|
|
||||||
|
|
||||||
if (passwd1.val().length > 0 && passwd1.val().length < 8) {
|
|
||||||
shortpwd.css("display","block");
|
|
||||||
shortpwd.css("color","red");
|
|
||||||
labelPwd1.addClass(passwd1.val().length < 8 ? 'has-error' : 'has-success' )
|
|
||||||
.removeClass(passwd1.val().length < 8 ? 'has-error' : 'has-success' );
|
|
||||||
labelPwd2.addClass(passwd2.val().length < 8 ? 'has-error' : 'has-success' )
|
|
||||||
.removeClass(passwd2.val().length < 8 ? 'has-error' : 'has-success' );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
shortpwd.css("display","none");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$( "#country" ).change(function() {
|
|
||||||
$.ajax({
|
|
||||||
url: "${findState}" ,
|
|
||||||
type: 'POST',
|
|
||||||
datatype:'json',
|
|
||||||
data: {
|
|
||||||
countryName: $("#country").val()
|
|
||||||
},
|
|
||||||
success: function(data){
|
|
||||||
var content= JSON.parse(data);
|
|
||||||
$('#state').html('');// to clear the previous option
|
|
||||||
$.each(content, function(i, state) {
|
|
||||||
$('#state').append($('<option>').text(state.name).attr('value', state.stateId));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<b>Change the Country State Change By Ajax</b> <br><br>
|
<div id="errorDiv" style="display: none;" class="alert alert-error">
|
||||||
Country:
|
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||||
<select id="country" name="country">
|
<h1>Oh snap! You got an error</h1>
|
||||||
<option value="select">Select Country</option>
|
<label id="errorLabel"></label> <br> <br /> If you believe this
|
||||||
<option value="india">India</option>
|
requires support please go to <a
|
||||||
<option value="usa">USA</option>
|
href="http://www.d4science.org/contact-us" target="_blank">http://www.d4science.org/contact-us</a>
|
||||||
</select>
|
to ask for D4Science Help Desk support. <br> <br />
|
||||||
|
</div>
|
||||||
|
|
||||||
<br><br>
|
<div id="successDiv" style="display: none;" class="alert alert-success">
|
||||||
State:
|
<h1>Well done!</h1>
|
||||||
<select id="state" name="state">
|
Your account has been successfully created! You will now be asked to enter sign in on this
|
||||||
</select>
|
portal using your yet created account. Please, click on the button below to continue.
|
||||||
<h1>
|
<%
|
||||||
Hello
|
String acceptInviteURL = request.getAttribute("landingPage") + "/explore?" + InvitesManager.SITEID_ATTR
|
||||||
<c:out escapeXml="true" value="${invitedUser.firstName}" />!<br>
|
+ "=" + request.getAttribute("groupId");
|
||||||
</h1>
|
%>
|
||||||
|
<p style="margin-top: 20px;">
|
||||||
<p class="lead">
|
<button class="btn btn-large"
|
||||||
You have recently received an invitation from
|
onclick="window.location.href='<%=acceptInviteURL%>'" type="button">
|
||||||
<c:out escapeXml="true" value="${inviteInstance.senderFullName}" />
|
Continue accept invite on
|
||||||
to join the <a
|
<c:out escapeXml="true" value="${vreName}" />
|
||||||
href="/web<c:out escapeXml="true" value="${vreFriendlyURL}" />"
|
</button>
|
||||||
target="_blank"><c:out escapeXml="true" value="${vreName}" /></a>
|
</p>
|
||||||
Virtual Research Environment.
|
</div>
|
||||||
<c:choose>
|
<div id="formCreateAccountWrapper">
|
||||||
<c:when test="${empty invitedUser}">
|
<h1>
|
||||||
<br />
|
Hello
|
||||||
<span style="font-style: italic;">Please note</span>: the invite is valid for your email <a
|
<c:out escapeXml="true" value="${invitedUser.firstName}" />
|
||||||
href="mailto:<c:out escapeXml="true" value="${inviteInstance.invitedEmail}" />">
|
!<br>
|
||||||
<c:out escapeXml="true" value="${inviteInstance.invitedEmail}" />
|
</h1>
|
||||||
</a> only. To accept the invite, please fill in the information below:
|
<p class="lead">
|
||||||
|
You have recently received an invitation from
|
||||||
|
<c:out escapeXml="true" value="${inviteInstance.senderFullName}" />
|
||||||
|
to join the <a
|
||||||
|
href="/web<c:out escapeXml="true" value="${vreFriendlyURL}" />"
|
||||||
|
target="_blank"><c:out escapeXml="true" value="${vreName}" /></a>
|
||||||
|
Virtual Research Environment. <img id="loadingAjaxCallback"
|
||||||
|
style="display: none;"
|
||||||
|
src="<%=renderRequest.getContextPath()%>/images/loader.gif" />
|
||||||
|
<c:choose>
|
||||||
|
<c:when test="${empty invitedUser}">
|
||||||
|
<br />
|
||||||
|
<span style="font-style: italic;">Please note</span>: the invite is valid for your email <a
|
||||||
|
href="mailto:<c:out escapeXml="true" value="${inviteInstance.invitedEmail}" />">
|
||||||
|
<c:out escapeXml="true" value="${inviteInstance.invitedEmail}" />
|
||||||
|
</a> only. To accept the invite, please fill in the information below:
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label>Email (Not editable)</label> <input type="text" name="email"
|
<label>Email (Not editable)</label> <input type="text"
|
||||||
value="${inviteInstance.invitedEmail}" readonly style="color: #999;"/>
|
name="email" value="${inviteInstance.invitedEmail}" readonly
|
||||||
<label id="labelFirstName">First Name (Required)</label>
|
id="email" style="color: #999;" /> <label id="labelFirstName">First
|
||||||
<input type="text" id="firstname" />
|
Name (Required)</label> <input type="text" id="firstname" /> <label
|
||||||
<label id="labelLastName">Last Name (Required)</label>
|
id="labelLastName">Last Name (Required)</label> <input
|
||||||
<input type="text" id="lastname" />
|
type="text" id="lastname" />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label id="labelPwd1">Password</label>
|
<label id="labelPwd1">Password</label> <input type="password"
|
||||||
<input type="password" id="password" />
|
id="password" /> <label id="labelPwd2">Confirm
|
||||||
<label id="labelPwd2">Confirm Password</label>
|
Password</label> <input type="password" id="repassword" /> <label
|
||||||
<input type="password" id="repassword"/>
|
style="display: none" id="labelPasswordDontMatch">Passwords
|
||||||
<label style="display: none" id="labelPasswordDontMatch">Passwords don't match</label>
|
don't match</label> <label style="display: none"
|
||||||
<label style="display: none" id="labelPasswordTooShort">Passwords must be at least 8 chars length</label>
|
id="labelPasswordTooShort">Password must be at least 8
|
||||||
<div style="margin-top: 20px;">
|
chars length</label>
|
||||||
<button class="btn-primary btn-large" type="button" id="createAccountButton">Continue</button>
|
<div style="margin-top: 20px;">
|
||||||
</div>
|
<button class="btn-primary btn-large" type="button"
|
||||||
</fieldset>
|
id="createAccountButton">Continue</button>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</c:when>
|
</c:when>
|
||||||
<c:otherwise>
|
<c:otherwise>
|
||||||
This invite is valid for your email <a
|
This invite is valid for your email <a
|
||||||
href="mailto:<c:out escapeXml="true" value="${inviteInstance.invitedEmail}" />">
|
href="mailto:<c:out escapeXml="true" value="${inviteInstance.invitedEmail}" />">
|
||||||
<c:out escapeXml="true" value="${inviteInstance.invitedEmail}" />
|
<c:out escapeXml="true" value="${inviteInstance.invitedEmail}" />
|
||||||
</a> only, you will be asked to enter your password associated to it on this portal.
|
</a> only, you will be asked to enter your password associated to it on this portal.
|
||||||
|
|
||||||
<%
|
<%
|
||||||
String exploreURL = request.getAttribute("landingPage") + "/explore?" + InvitesManager.SITEID_ATTR
|
String exploreURL = request.getAttribute("landingPage") + "/explore?" + InvitesManager.SITEID_ATTR
|
||||||
+ "=" + request.getAttribute("groupId");
|
+ "=" + request.getAttribute("groupId");
|
||||||
%>
|
%>
|
||||||
<p class="lead">
|
<p class="lead">
|
||||||
<button class="btn btn-large btn-primary"
|
<button class="btn btn-large btn-primary"
|
||||||
onclick="window.location.href='<%=exploreURL%>'" type="button">
|
onclick="window.location.href='<%=exploreURL%>'" type="button">
|
||||||
Accept invite on
|
Accept invite on
|
||||||
<c:out escapeXml="true" value="${vreName}" />
|
<c:out escapeXml="true" value="${vreName}" />
|
||||||
</button>
|
</button>
|
||||||
</p>
|
</p>
|
||||||
</c:otherwise>
|
</c:otherwise>
|
||||||
</c:choose>
|
</c:choose>
|
||||||
|
</p>
|
||||||
</p>
|
</div>
|
||||||
|
|
||||||
<br>
|
|
||||||
<c:out escapeXml="true" value="${inviteInstance} " />
|
|
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
|
@ -0,0 +1,61 @@
|
||||||
|
$(document).ready(function(){
|
||||||
|
$( "#createAccountButton" ).click(function() {
|
||||||
|
var firstnameBox = $.trim( $('#firstname').val() )
|
||||||
|
if (firstnameBox == "") {
|
||||||
|
$('#labelFirstName').css("color","red");
|
||||||
|
$('#labelFirstName').text("First Name (This field is required)");
|
||||||
|
} else {
|
||||||
|
$('#labelFirstName').css("color","#555");
|
||||||
|
$('#labelFirstName').text("First Name (Required)");
|
||||||
|
}
|
||||||
|
var lastnameBox = $.trim( $('#lastname').val() )
|
||||||
|
if (lastnameBox == "") {
|
||||||
|
$('#labelLastName').css("color","red");
|
||||||
|
$('#labelLastName').text("Last Name (This field is required)");
|
||||||
|
} else {
|
||||||
|
$('#labelLastName').css("color","#555");
|
||||||
|
$('#labelLastName').text("Last Name (Required)");
|
||||||
|
}
|
||||||
|
|
||||||
|
var passwd1 = $('#password');
|
||||||
|
var labelPwd1 = $('#labelPwd1');
|
||||||
|
var passwd2 = $('#repassword');
|
||||||
|
var labelPwd2 = $('#labelPwd2');
|
||||||
|
|
||||||
|
labelPwd1.addClass( passwd1.val().length === 0 ? 'has-error' : 'has-success' );
|
||||||
|
labelPwd2.addClass( passwd2.val().length === 0 ? 'has-error' : 'has-success' );
|
||||||
|
|
||||||
|
var nomatch = $('#labelPasswordDontMatch');
|
||||||
|
|
||||||
|
if (passwd1.val() !== passwd2.val()) {
|
||||||
|
nomatch.css("display","block");
|
||||||
|
nomatch.css("color","red");
|
||||||
|
labelPwd1.addClass( passwd1.val() !== passwd2.val() ? 'has-error' : 'has-success' )
|
||||||
|
.removeClass( passwd1.val() === passwd2.val() ? 'has-error' : 'has-success' );
|
||||||
|
labelPwd2.addClass( passwd1.val() !== passwd2.val() ? 'has-error' : 'has-success' )
|
||||||
|
.removeClass( passwd1.val() === passwd2.val() ? 'has-error' : 'has-success' );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
nomatch.css("display","none");
|
||||||
|
}
|
||||||
|
|
||||||
|
var shortpwd = $('#labelPasswordTooShort');
|
||||||
|
|
||||||
|
if (passwd1.val().length > 0 && passwd1.val().length < 8) {
|
||||||
|
shortpwd.css("display","block");
|
||||||
|
shortpwd.css("color","red");
|
||||||
|
labelPwd1.addClass(passwd1.val().length < 8 ? 'has-error' : 'has-success' )
|
||||||
|
.removeClass(passwd1.val().length < 8 ? 'has-error' : 'has-success' );
|
||||||
|
labelPwd2.addClass(passwd2.val().length < 8 ? 'has-error' : 'has-success' )
|
||||||
|
.removeClass(passwd2.val().length < 8 ? 'has-error' : 'has-success' );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
shortpwd.css("display","none");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (passwd1.val() == passwd2.val() && passwd1.val().length >= 8 && lastnameBox != "" && firstnameBox != "") {
|
||||||
|
doCallback();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue