added extensio to support oAuth2 requesting applications

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/liferay62-plugins/login-hook@142010 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2017-02-01 17:00:12 +00:00
parent 117dc919cd
commit fb75255689
2 changed files with 102 additions and 89 deletions

View File

@ -50,9 +50,6 @@
this application's request to access your member data and interact this application's request to access your member data and interact
with D4Science on your behalf. with D4Science on your behalf.
<p> <p>
<p>
<button class="btn" onClick="location.href='<%=context.getGatewayURL(request)%>'">Cancel</button>
</p>
</div> </div>
<% <%
} else { } else {

View File

@ -20,7 +20,8 @@
<script> <script>
window.jQuery window.jQuery
|| document || document
.write('<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"><\/script>') .write(
'<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"><\/script>')
</script> </script>
<script type="text/javascript" <script type="text/javascript"
src="/html/portlet/login/js/bootstrap-collapse.js"></script> src="/html/portlet/login/js/bootstrap-collapse.js"></script>
@ -32,7 +33,6 @@
<link rel="stylesheet" href="/html/portlet/login/css/login-hook.css"> <link rel="stylesheet" href="/html/portlet/login/css/login-hook.css">
<% <%
String[] socials = PropsUtil.getArray("login.form.navigation.socials"); String[] socials = PropsUtil.getArray("login.form.navigation.socials");
PortalContext context = PortalContext.getConfiguration(); PortalContext context = PortalContext.getConfiguration();
@ -52,19 +52,24 @@ boolean hideCreateAccountAndForgotPassword = false;
String myAccountURL = String.valueOf(themeDisplay.getURLMyAccount()); String myAccountURL = String.valueOf(themeDisplay.getURLMyAccount());
if (PropsValues.DOCKBAR_ADMINISTRATIVE_LINKS_SHOW_IN_POP_UP) { if (PropsValues.DOCKBAR_ADMINISTRATIVE_LINKS_SHOW_IN_POP_UP) {
signedInAs = "<a class=\"signed-in\" href=\"javascript:Liferay.Util.openWindow({dialog: {destroyOnHide: true}, title: '" + HtmlUtil.escapeJS(LanguageUtil.get(pageContext, "my-account")) + "', uri: '" + HtmlUtil.escapeJS(myAccountURL) + "'});\">" + signedInAs + "</a>"; signedInAs = "<a class=\"signed-in\" href=\"javascript:Liferay.Util.openWindow({dialog: {destroyOnHide: true}, title: '"
} + HtmlUtil.escapeJS(LanguageUtil.get(pageContext, "my-account")) + "', uri: '"
else { + HtmlUtil.escapeJS(myAccountURL) + "'});\">" + signedInAs + "</a>";
myAccountURL = HttpUtil.setParameter(myAccountURL, "controlPanelCategory", PortletCategoryKeys.MY); } else {
myAccountURL = HttpUtil.setParameter(myAccountURL, "controlPanelCategory",
PortletCategoryKeys.MY);
signedInAs = "<a class=\"signed-in\" href=\"" + HtmlUtil.escape(myAccountURL) + "\">" + signedInAs + "</a>"; signedInAs = "<a class=\"signed-in\" href=\"" + HtmlUtil.escape(myAccountURL) + "\">"
+ signedInAs + "</a>";
} }
} }
%> %>
<% <%
String siteMarkUp = "<a href=\"" + HtmlUtil.escape(siteUrl) + "\">" + themeDisplay.getSiteGroupName() +"</a>"; String siteMarkUp = "<a href=\"" + HtmlUtil.escape(siteUrl) + "\">"
String workSpaceMarkUp = "<a href=\"" + HtmlUtil.escape(workspaceUrl) + "\">" + LanguageUtil.get(pageContext, "shared-workspace") +"</a>"; + themeDisplay.getSiteGroupName() + "</a>";
String workSpaceMarkUp = "<a href=\"" + HtmlUtil.escape(workspaceUrl) + "\">"
+ LanguageUtil.get(pageContext, "shared-workspace") + "</a>";
%> %>
<%=LanguageUtil.format(pageContext, "you-are-signed-in-as-x", signedInAs, false)%> <%=LanguageUtil.format(pageContext, "you-are-signed-in-as-x", signedInAs, false)%>
@ -76,7 +81,8 @@ boolean hideCreateAccountAndForgotPassword = false;
</c:when> </c:when>
<c:otherwise> <c:otherwise>
<% <%
String redirect = ParamUtil.getString(request, "redirect");%> String redirect = ParamUtil.getString(request, "redirect");
%>
<!-- include for recongnizing requesting apps--> <!-- include for recongnizing requesting apps-->
<%@ include file="/html/portlet/login/RequestingApplication.jsp"%> <%@ include file="/html/portlet/login/RequestingApplication.jsp"%>
@ -124,11 +130,15 @@ boolean hideCreateAccountAndForgotPassword = false;
<%=LanguageUtil.get(pageContext, "thank-you-for-creating-an-account")%> <%=LanguageUtil.get(pageContext, "thank-you-for-creating-an-account")%>
<c:if test="<%=company.isStrangersVerify()%>"> <c:if test="<%=company.isStrangersVerify()%>">
<%= LanguageUtil.format(pageContext, "your-email-verification-code-has-been-sent-to-x", userEmailAddress) %> <%=LanguageUtil.format(pageContext,
"your-email-verification-code-has-been-sent-to-x",
userEmailAddress)%>
</c:if> </c:if>
</c:when> </c:when>
<c:otherwise> <c:otherwise>
<%= LanguageUtil.format(pageContext, "thank-you-for-creating-an-account.-your-password-is-x", userPassword, false) %> <%=LanguageUtil.format(pageContext,
"thank-you-for-creating-an-account.-your-password-is-x", userPassword,
false)%>
</c:otherwise> </c:otherwise>
</c:choose> </c:choose>
@ -145,7 +155,9 @@ boolean hideCreateAccountAndForgotPassword = false;
%> %>
<div class="alert alert-success"> <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) %> <%=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> </div>
</c:when> </c:when>
</c:choose> </c:choose>
@ -177,17 +189,16 @@ boolean hideCreateAccountAndForgotPassword = false;
if (authType.equals(CompanyConstants.AUTH_TYPE_EA)) { if (authType.equals(CompanyConstants.AUTH_TYPE_EA)) {
loginLabel = "email-address"; loginLabel = "email-address";
} } else if (authType.equals(CompanyConstants.AUTH_TYPE_SN)) {
else if (authType.equals(CompanyConstants.AUTH_TYPE_SN)) {
loginLabel = "screen-name"; loginLabel = "screen-name";
} } else if (authType.equals(CompanyConstants.AUTH_TYPE_ID)) {
else if (authType.equals(CompanyConstants.AUTH_TYPE_ID)) {
loginLabel = "id"; loginLabel = "id";
} }
%> %>
<div class="custom-form-login-wrapper"> <div class="custom-form-login-wrapper">
<aui:input <aui:input
autoFocus="<%= windowState.equals(LiferayWindowState.EXCLUSIVE) || windowState.equals(WindowState.MAXIMIZED) %>" autoFocus="<%=windowState.equals(LiferayWindowState.EXCLUSIVE)
|| windowState.equals(WindowState.MAXIMIZED)%>"
cssClass="clearable login-identifier input-xlarge" cssClass="clearable login-identifier input-xlarge"
placeholder="<%=loginLabel%>" label="" name="login" placeholder="<%=loginLabel%>" label="" name="login"
showRequiredLabel="<%=false%>" type="text"> showRequiredLabel="<%=false%>" type="text">
@ -219,7 +230,12 @@ boolean hideCreateAccountAndForgotPassword = false;
</aui:fieldset> </aui:fieldset>
</aui:form> </aui:form>
<c:if test="<%=hideCreateAccountAndForgotPassword == true%>">
<div style="text-align: center;">
<button class="btn input-xlarge"
onClick="location.href='<%=context.getGatewayURL(request)%>'">Cancel</button>
</div>
</c:if>
<liferay-util:include page="/html/portlet/login/navigation.jsp" /> <liferay-util:include page="/html/portlet/login/navigation.jsp" />
<c:if test="<%=socials.length > 0%>"> <c:if test="<%=socials.length > 0%>">