Massimiliano Assante 2018-10-25 14:31:01 +00:00
parent 3d401debb0
commit 55b1419bc0
8 changed files with 303 additions and 187 deletions

View File

@ -1,4 +1,7 @@
<ReleaseNotes>
<Changeset component="gr.cite.login.login-hook.1-2-0" date="2018-10-25">
<Change>Restyled login page</Change>
</Changeset>
<Changeset component="gr.cite.login.login-hook.1-2-0" date="2017-02-06">
<Change>Implemented support for oAuth 2</Change>
</Changeset>

View File

@ -14,7 +14,7 @@
<artifactId>login-hook</artifactId>
<packaging>war</packaging>
<name>login-hook Hook</name>
<version>1.3.1-SNAPSHOT</version>
<version>1.4.0-SNAPSHOT</version>
<scm>
<connection>scm:svn:https://svn.d4science.research-infrastructures.eu/gcube/branches/portal/login-hook/1.2</connection>

View File

@ -10,4 +10,4 @@
## ##
###########################################################################################################################
login.form.navigation.socials=google, linkedIn
login.form.navigation.socials=google, linkedIn, shibboleth

View File

@ -1,3 +1,21 @@
.aui .portlet {
background-color: transparent;
border: none;
}
.aui .portlet-topper {
background-color: transparent;
display: none;
}
.portlet-login .accordion {
margin-top: 40px;
}
.portlet-login div.navigation, #signinmodal div.navigation {
background: none;
background-color: transparent;
}
.portlet-login .accordion .accordion-heading > a, #signinmodal .accordion .accordion-heading > a{
display: block;
text-align: center;
@ -11,11 +29,21 @@
border-top: none;
}
.portlet-login div.navigation, #signinmodal div.navigation {
background: white;
border-top: none;
.portlet-login #d4s-signin-form {
background-color: transparent;
padding: 5px;
border-radius: 6px;
}
.portlet-login input:-webkit-autofill, textarea:-webkit-autofill, select:-webkit-autofill {
background-color: white !important;
}
/* .portlet-login div.navigation, #signinmodal div.navigation { */
/* background: white; */
/* border-top: none; */
/* } */
.portlet-login input.login-identifier, .portlet-login input.login-password,
#signinmodal input.login-identifier, #signinmodal input.login-password {
border-radius: 5px;
@ -38,7 +66,12 @@
}
.portlet-login .portlet-content-container .login-sign-in {
display:none;
font-size: 16px;
font-weight: 400;
line-height: 2.2;
color: #01497C;
text-align: left;
padding: 0 10px 10px;
}
.portlet-login .login-remember-me, #signinmodal .login-remember-me {
@ -51,10 +84,11 @@
}
.portlet-login .navigation li[role=presentation] > a,
#signinmodal .navigation li[role=presentation] > a,
.portlet-login .login-remember-me label,
#signinmodal .login-remember-me label {
color: #9E9696;
#signinmodal .navigation li[role=presentation] > a {
color: #01497C;
font-size: 1.2em;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
line-height: 20px;
}
.portlet-login form, #signinmodal form{
@ -66,7 +100,7 @@
}
.portlet-login .navigation, #signinmodal .navigation{
padding : 0px 10px 10px 10px;
padding : 10px;
}
.portlet-login .custom-form-login-wrapper, #signinmodal .custom-form-login-wrapper{
@ -86,5 +120,5 @@
.portlet-login .social,
#signinmodal .social {
margin-bottom: 5px;
margin-bottom: 15px;
}

View File

@ -47,7 +47,7 @@
%>
<c:choose>
<c:when test="<%=themeDisplay.isSignedIn()%>">
<%
String signedInAs = HtmlUtil.escape(user.getFullName());
@ -74,204 +74,209 @@
String workSpaceMarkUp = "<a href=\"" + HtmlUtil.escape(workspaceUrl) + "\">"
+ LanguageUtil.get(pageContext, "shared-workspace") + "</a>";
%>
<div id="note-text-loggedin" style="font-size: 1.5em; line-height: 20px;">
<%=LanguageUtil.format(pageContext, "you-are-signed-in-as-x", signedInAs, false)%>
<br>
<br>
<%=LanguageUtil.format(pageContext, "go-to-x", siteMarkUp, false)%>
<br>
<br>
<%=LanguageUtil.format(pageContext, "go-to-x", workSpaceMarkUp, false)%>
</div>
</c:when>
<c:otherwise>
<%
String redirect = ParamUtil.getString(request, "redirect");
%>
<div class="row-fluid">
<div class="span6 text-center" id="d4s-signin-form">
<%
String redirect = ParamUtil.getString(request, "redirect");
%>
<!-- include for recognising requesting apps-->
<%@ include file="/html/portlet/login/RequestingApplication.jsp"%>
<!-- end include for recognising requesting apps-->
<!-- include for recognising requesting apps-->
<%@ include file="/html/portlet/login/RequestingApplication.jsp"%>
<!-- end include for recognising requesting apps-->
<h4 class="login-sign-in"><%=LanguageUtil.get(pageContext, "sign-in")%></h4>
<%
String login = LoginUtil.getLogin(request, "login", company);
String password = StringPool.BLANK;
boolean rememberMe = ParamUtil.getBoolean(request, "rememberMe");
if (Validator.isNull(authType)) {
authType = company.getAuthType();
}
%>
<portlet:actionURL
secure="<%=PropsValues.COMPANY_SECURITY_AUTH_REQUIRES_HTTPS || request.isSecure()%>"
var="loginURL">
<portlet:param name="struts_action" value="/login/login" />
</portlet:actionURL>
<!-- START CLIENT NOT AUTHORISED -->
<c:if test="<%=clientNotAuthorised == false%>">
<aui:form action="<%=loginURL%>"
autocomplete='<%=PropsValues.COMPANY_SECURITY_LOGIN_FORM_AUTOCOMPLETE ? "on" : "off"%>'
cssClass="sign-in-form" method="post" name="fm">
<aui:input name="saveLastPath" type="hidden" value="<%=false%>" />
<aui:input name="redirect" type="hidden" value="<%=redirect%>" />
<aui:input name="doActionAfterLogin" type="hidden"
value="<%=portletName.equals(PortletKeys.FAST_LOGIN) ? true : false%>" />
<c:choose>
<c:when test='<%=SessionMessages.contains(request, "userAdded")%>'>
<%
String userEmailAddress = (String) SessionMessages.get(request, "userAdded");
String userPassword = (String) SessionMessages.get(request, "userAddedPassword");
%>
<div class="alert alert-success">
<c:choose>
<c:when
test="<%=company.isStrangersVerify() || Validator.isNull(userPassword)%>">
<%=LanguageUtil.get(pageContext, "thank-you-for-creating-an-account")%>
<c:if test="<%=company.isStrangersVerify()%>">
<%=LanguageUtil.format(pageContext,
"your-email-verification-code-has-been-sent-to-x",
userEmailAddress)%>
</c:if>
</c:when>
<c:otherwise>
<%=LanguageUtil.get(pageContext, "thank-you-for-creating-an-account")%> Please login now.
</c:otherwise>
</c:choose>
<%-- <c:if test="<%= PrefsPropsUtil.getBoolean(company.getCompanyId(), PropsKeys.ADMIN_EMAIL_USER_ADDED_ENABLED) %>">
<%= LanguageUtil.format(pageContext, "your-password-has-been-sent-to-x", userEmailAddress) %>
</c:if> --%>
</div>
</c:when>
<c:when
test='<%=SessionMessages.contains(request, "userPending")%>'>
<%
String userEmailAddress = (String) SessionMessages.get(request, "userPending");
%>
<div class="alert alert-success">
<%=LanguageUtil.format(pageContext,
"thank-you-for-creating-an-account.-you-will-be-notified-via-email-at-x-when-your-account-has-been-approved",
userEmailAddress)%>
</div>
</c:when>
</c:choose>
<liferay-ui:error exception="<%=AuthException.class%>"
message="authentication-failed" />
<liferay-ui:error exception="<%=CompanyMaxUsersException.class%>"
message="unable-to-login-because-the-maximum-number-of-users-has-been-reached" />
<liferay-ui:error
exception="<%=CookieNotSupportedException.class%>"
message="authentication-failed-please-enable-browser-cookies" />
<liferay-ui:error exception="<%=NoSuchUserException.class%>"
message="authentication-failed" />
<liferay-ui:error exception="<%=PasswordExpiredException.class%>"
message="your-password-has-expired" />
<liferay-ui:error exception="<%=UserEmailAddressException.class%>"
message="authentication-failed" />
<liferay-ui:error exception="<%=UserLockoutException.class%>"
message="this-account-has-been-locked" />
<liferay-ui:error exception="<%=UserPasswordException.class%>"
message="authentication-failed" />
<liferay-ui:error exception="<%=UserScreenNameException.class%>"
message="authentication-failed" />
<aui:fieldset>
<div class="login-sign-in">&nbsp;</div>
<%
String loginLabel = null;
String login = LoginUtil.getLogin(request, "login", company);
String password = StringPool.BLANK;
boolean rememberMe = ParamUtil.getBoolean(request, "rememberMe");
if (authType.equals(CompanyConstants.AUTH_TYPE_EA)) {
loginLabel = "email-address";
} else if (authType.equals(CompanyConstants.AUTH_TYPE_SN)) {
loginLabel = "screen-name";
} else if (authType.equals(CompanyConstants.AUTH_TYPE_ID)) {
loginLabel = "id";
}
if (Validator.isNull(authType)) {
authType = company.getAuthType();
}
%>
<div class="custom-form-login-wrapper">
<aui:input
autoFocus="<%=windowState.equals(LiferayWindowState.EXCLUSIVE)
|| windowState.equals(WindowState.MAXIMIZED)%>"
cssClass="clearable login-identifier input-xlarge"
placeholder="<%=loginLabel%>" label="" name="login"
showRequiredLabel="<%=false%>" type="text">
<aui:validator name="required" />
</aui:input>
<portlet:actionURL
secure="<%=PropsValues.COMPANY_SECURITY_AUTH_REQUIRES_HTTPS || request.isSecure()%>"
var="loginURL">
<portlet:param name="struts_action" value="/login/login" />
</portlet:actionURL>
<!-- START CLIENT NOT AUTHORISED -->
<c:if test="<%=clientNotAuthorised == false%>">
<aui:input name="password" placeholder="password"
cssClass="login-password input-xlarge" label=""
showRequiredLabel="<%=false%>" type="password"
value="<%=password%>">
<aui:validator name="required" />
</aui:input>
<aui:form action="<%=loginURL%>"
autocomplete='<%=PropsValues.COMPANY_SECURITY_LOGIN_FORM_AUTOCOMPLETE ? "on" : "off"%>'
cssClass="sign-in-form" method="post" name="fm">
<aui:input name="saveLastPath" type="hidden" value="<%=false%>" />
<aui:input name="redirect" type="hidden" value="<%=redirect%>" />
<aui:input name="doActionAfterLogin" type="hidden"
value="<%=portletName.equals(PortletKeys.FAST_LOGIN) ? true : false%>" />
<aui:button type="submit"
cssClass="login-sign-in-button input-xlarge" value="sign-in" />
<c:choose>
<c:when
test='<%=SessionMessages.contains(request, "userAdded")%>'>
<span id="<portlet:namespace />passwordCapsLockSpan"
style="display: none;"><liferay-ui:message
key="caps-lock-is-on" /></span>
<%
String userEmailAddress = (String) SessionMessages.get(request, "userAdded");
String userPassword = (String) SessionMessages.get(request, "userAddedPassword");
%>
<c:if
test="<%=company.isAutoLogin() && !PropsValues.SESSION_DISABLED%>">
<div class="login-remember-me">
<aui:input checked="<%=rememberMe%>" name="rememberMe"
type="checkbox" />
<div class="alert alert-success">
<c:choose>
<c:when
test="<%=company.isStrangersVerify() || Validator.isNull(userPassword)%>">
<%=LanguageUtil.get(pageContext, "thank-you-for-creating-an-account")%>
<c:if test="<%=company.isStrangersVerify()%>">
<%=LanguageUtil.format(pageContext,
"your-email-verification-code-has-been-sent-to-x",
userEmailAddress)%>
</c:if>
</c:when>
<c:otherwise>
<%=LanguageUtil.get(pageContext, "thank-you-for-creating-an-account")%> Please login now.
</c:otherwise>
</c:choose>
<%-- <c:if test="<%= PrefsPropsUtil.getBoolean(company.getCompanyId(), PropsKeys.ADMIN_EMAIL_USER_ADDED_ENABLED) %>">
<%= LanguageUtil.format(pageContext, "your-password-has-been-sent-to-x", userEmailAddress) %>
</c:if> --%>
</div>
</c:when>
<c:when
test='<%=SessionMessages.contains(request, "userPending")%>'>
<%
String userEmailAddress = (String) SessionMessages.get(request, "userPending");
%>
<div class="alert alert-success">
<%=LanguageUtil.format(pageContext,
"thank-you-for-creating-an-account.-you-will-be-notified-via-email-at-x-when-your-account-has-been-approved",
userEmailAddress)%>
</div>
</c:when>
</c:choose>
<liferay-ui:error exception="<%=AuthException.class%>"
message="authentication-failed" />
<liferay-ui:error exception="<%=CompanyMaxUsersException.class%>"
message="unable-to-login-because-the-maximum-number-of-users-has-been-reached" />
<liferay-ui:error
exception="<%=CookieNotSupportedException.class%>"
message="authentication-failed-please-enable-browser-cookies" />
<liferay-ui:error exception="<%=NoSuchUserException.class%>"
message="authentication-failed" />
<liferay-ui:error exception="<%=PasswordExpiredException.class%>"
message="your-password-has-expired" />
<liferay-ui:error exception="<%=UserEmailAddressException.class%>"
message="authentication-failed" />
<liferay-ui:error exception="<%=UserLockoutException.class%>"
message="this-account-has-been-locked" />
<liferay-ui:error exception="<%=UserPasswordException.class%>"
message="authentication-failed" />
<liferay-ui:error exception="<%=UserScreenNameException.class%>"
message="authentication-failed" />
<aui:fieldset>
<%
String loginLabel = null;
if (authType.equals(CompanyConstants.AUTH_TYPE_EA)) {
loginLabel = "email-address";
} else if (authType.equals(CompanyConstants.AUTH_TYPE_SN)) {
loginLabel = "screen-name";
} else if (authType.equals(CompanyConstants.AUTH_TYPE_ID)) {
loginLabel = "id";
}
%>
<div class="custom-form-login-wrapper">
<aui:input
autoFocus="<%=windowState.equals(LiferayWindowState.EXCLUSIVE)
|| windowState.equals(WindowState.MAXIMIZED)%>"
cssClass="clearable login-identifier input-xlarge"
placeholder="<%=loginLabel%>" label="" name="login"
showRequiredLabel="<%=false%>" type="text">
<aui:validator name="required" />
</aui:input>
<aui:input name="password" placeholder="password"
cssClass="login-password input-xlarge" label=""
showRequiredLabel="<%=false%>" type="password"
value="<%=password%>">
<aui:validator name="required" />
</aui:input>
<aui:button type="submit"
cssClass="login-sign-in-button input-xlarge" value="sign-in" />
<span id="<portlet:namespace />passwordCapsLockSpan"
style="display: none;"><liferay-ui:message
key="caps-lock-is-on" /></span>
<c:if
test="<%=company.isAutoLogin() && !PropsValues.SESSION_DISABLED%>">
<div class="login-remember-me">
<aui:input checked="<%=rememberMe%>" name="rememberMe"
type="checkbox" />
</div>
</c:if>
</div>
</aui:fieldset>
</aui:form>
<c:if test="<%=hideCreateAccountAndForgotPassword == true%>">
<%
Map<String, String> queryMap = AuthUtil.getQueryMap(redirect);
String redirectURI = queryMap.get(GET_REDIRECTURL_PARAMETER);
String responseWithError = redirectURI
+ "?error=user_cancelled_login&error_description=refused%2flogin&state="
+ queryMap.get(GET_STATE_PARAMETER);
%>
<div style="text-align: center;">
<button class="btn input-xlarge"
onClick="location.href='<%=responseWithError%>'">Deny
Access</button>
</div>
</c:if>
</div>
</aui:fieldset>
</aui:form>
<c:if test="<%=hideCreateAccountAndForgotPassword == true%>">
<%
Map<String, String> queryMap = AuthUtil.getQueryMap(redirect);
String redirectURI = queryMap.get(GET_REDIRECTURL_PARAMETER);
String responseWithError = redirectURI+"?error=user_cancelled_login&error_description=refused%2flogin&state="+queryMap.get(GET_STATE_PARAMETER);
%>
<div style="text-align: center;">
<button class="btn input-xlarge"
onClick="location.href='<%=responseWithError%>'">Deny Access</button>
<liferay-util:include page="/html/portlet/login/navigation.jsp" />
</div>
</c:if>
<liferay-util:include page="/html/portlet/login/navigation.jsp" />
<c:if test="<%=socials.length > 0%>">
<div class="accordion" id="accordion" role="tablist">
<div class="accordion-group">
<div class="accordion-heading">
<a data-toggle="collapse" data-parent="#accordion"
href="#collapseMe" aria-expanded="true"
aria-controls="collapseMe">
<h4>
<i class="icon-double-angle-up"></i>
</h4>
</a>
</div>
<div id="collapseMe" class="accordion-body collapse in">
<div class="accordion-inner">
<liferay-util:include page="/html/portlet/login/social.jsp" />
<div class="span6">
<c:if test="<%=socials.length > 0%>">
<div class="accordion" id="accordion" role="tablist">
<div class="accordion-group">
<div class="accordion-inner">
<liferay-util:include page="/html/portlet/login/social.jsp" />
</div>
</div>
<!-- <div class="span12"> -->
<!-- <div class="span3"></div> -->
<!-- <div class="span6 text-center"> -->
<!-- <p class="text-info" id="note-text-accounts">Please note: it is possible -->
<!-- connect and existing account once logged in. If a new e-mail address is -->
<!-- used, a new account will be automatically created.</p> -->
<!-- </div> -->
<!-- <div class="span3"></div> -->
<!-- </div> -->
</div>
</div>
<div class="span12 text-center">
<p class="text-info">E-mail addresses already connected with existing accounts allow signing in with them. If a new e-mail address is used, a new account will be automatically created.</p>
</div>
</c:if>
</div>
</c:if>
<!-- END CLIENT NOT AUTHORISED -->
</c:if>
<!-- END CLIENT NOT AUTHORISED -->
</c:if>
<aui:script use="aui-base">
<aui:script use="aui-base">
var password = A.one('#<portlet:namespace />password');
if (password) {

View File

@ -0,0 +1,35 @@
<%--
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ include file="/html/portlet/login/init.jsp" %>
<%
String strutsAction = ParamUtil.getString(request, "struts_action");
boolean showCreateAccountIcon = false;
if (!strutsAction.equals("/login/create_account") && company.isStrangers() && !portletName.equals(PortletKeys.FAST_LOGIN)) {
showCreateAccountIcon = true;
}
%>
<c:if test="<%= showCreateAccountIcon %>">
<liferay-ui:icon
iconCssClass="icon-user"
message="create-account"
url="<%= PortalUtil.getCreateAccountURL(request, themeDisplay) %>"
/>
</c:if>

View File

@ -0,0 +1,39 @@
<%--
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ include file="/html/portlet/login/init.jsp" %>
<%
String strutsAction = ParamUtil.getString(request, "struts_action");
boolean showForgotPasswordIcon = false;
if (!strutsAction.equals("/login/forgot_password") && (company.isSendPassword() || company.isSendPasswordResetLink())) {
showForgotPasswordIcon = true;
}
%>
<c:if test="<%= showForgotPasswordIcon %>">
<portlet:renderURL var="forgotPasswordURL">
<portlet:param name="struts_action" value="/login/forgot_password" />
</portlet:renderURL>
<liferay-ui:icon
iconCssClass="icon-exclamation-sign"
message="forgot-password"
url="<%= forgotPasswordURL %>"
/>
</c:if>

View File

@ -1,6 +1,6 @@
name=login-hook
module-group-id=liferay
module-incremental-version=3
module-incremental-version=4
tags=
short-description=
change-log=