如何自定义Liferay 7 portal的Log in登录界面

时间:2023-02-21 17:55:52

前提:

1. Liferay portal 7

2. Liferay IDE 3.0.1

Liferay现有的工具中提供了很多修改portal的模板,以满足开发者的各种自定义需求。

修改的原理是利用Module小模块嵌到原来的代码中去,只是相当于打了一个补丁,并不会修改portal的源码,所以说是一种安全简单的方法。

步骤:

1. 新建一个Liferay Mudule Fragment Project(在选择HOST OSGi Bundle时选择com.liferay.login.web-version.jar,选择Override File Path点击Liferay蓝色的小图标选择META-INF/resources/login.jsp)

如何自定义Liferay 7 portal的Log in登录界面

2.Click finish. 然后修改相应的jsp文件,改成你想要的界面,我只是做了一些小修改,看代码:

<%--
/**
* Copyright (c) 2000-present 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="/init.jsp" %>
<p>Hello Joye</p> <c:choose>
<c:when test="<%= themeDisplay.isSignedIn() %>"> <%
String signedInAs = HtmlUtil.escape(user.getFullName());
if (themeDisplay.isShowMyAccountIcon() && (themeDisplay.getURLMyAccount() != null)) {
String myAccountURL = String.valueOf(themeDisplay.getURLMyAccount());
signedInAs = "<a class=\"signed-in\" href=\"" + HtmlUtil.escape(myAccountURL) + "\">" + signedInAs + "</a>";
}
%> <liferay-ui:message arguments="<%= signedInAs %>" key="you-are-signed-in-as-x" translateArguments="<%= false %>" />
</c:when>
<c:otherwise> <%
String redirect = ParamUtil.getString(request, "redirect");
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 name="/login/login" secure="<%= PropsValues.COMPANY_SECURITY_AUTH_REQUIRES_HTTPS || request.isSecure() %>" var="loginURL" /> <aui:form action="<%= loginURL %>" autocomplete='<%= PropsValues.COMPANY_SECURITY_LOGIN_FORM_AUTOCOMPLETE ? "on" : "off" %>' cssClass="sign-in-form" method="post" name="fm" onSubmit="event.preventDefault();">
<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) %>">
<liferay-ui:message key="thank-you-for-creating-an-account" /> <c:if test="<%= company.isStrangersVerify() %>">
<liferay-ui:message arguments="<%= userEmailAddress %>" key="your-email-verification-code-has-been-sent-to-x" translateArguments="<%= false %>" />
</c:if>
</c:when>
<c:otherwise>
<liferay-ui:message arguments="<%= userPassword %>" key="thank-you-for-creating-an-account.-your-password-is-x" translateArguments="<%= false %>" />
</c:otherwise>
</c:choose> <c:if test="<%= PrefsPropsUtil.getBoolean(company.getCompanyId(), PropsKeys.ADMIN_EMAIL_USER_ADDED_ENABLED) %>">
<liferay-ui:message arguments="<%= userEmailAddress %>" key="your-password-has-been-sent-to-x" translateArguments="<%= false %>" />
</c:if>
</div>
</c:when>
<c:when test='<%= SessionMessages.contains(request, "userPending") %>'> <%
String userEmailAddress = (String)SessionMessages.get(request, "userPending");
%> <div class="alert alert-success">
<liferay-ui:message arguments="<%= userEmailAddress %>" key="thank-you-for-creating-an-account.-you-will-be-notified-via-email-at-x-when-your-account-has-been-approved" translateArguments="<%= false %>" />
</div>
</c:when>
</c:choose> <liferay-ui:error exception="<%= AuthException.class %>" message="authentication-failed" />
<liferay-ui:error exception="<%= CompanyMaxUsersException.class %>" message="unable-to-log-in-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.MustNotBeNull.class %>" message="please-enter-an-email-address" />
<liferay-ui:error exception="<%= UserLockoutException.LDAPLockout.class %>" message="this-account-is-locked" /> <liferay-ui:error exception="<%= UserLockoutException.PasswordPolicyLockout.class %>"> <%
UserLockoutException.PasswordPolicyLockout ule = (UserLockoutException.PasswordPolicyLockout)errorException;
%> <liferay-ui:message arguments="<%= ule.user.getUnlockDate() %>" key="this-account-is-locked-until-x" translateArguments="<%= false %>" />
</liferay-ui:error> <liferay-ui:error exception="<%= UserPasswordException.class %>" message="authentication-failed" />
<liferay-ui:error exception="<%= UserScreenNameException.MustNotBeNull.class %>" message="the-screen-name-cannot-be-blank" /> <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";
}
%> <aui:input autoFocus="<%= windowState.equals(LiferayWindowState.EXCLUSIVE) || windowState.equals(WindowState.MAXIMIZED) %>" cssClass="clearable" label="<%= loginLabel %>" name="login" showRequiredLabel="<%= false %>" type="text" value="<%= login %>">
<aui:validator name="required" />
</aui:input> <aui:input name="password" showRequiredLabel="<%= false %>" type="password" value="<%= password %>">
<aui:validator name="required" />
</aui:input> <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 %>">
<aui:input checked="<%= rememberMe %>" name="forgetMe" type="checkbox" />
</c:if>
</aui:fieldset> <aui:button-row>
<aui:button type="submit" value="Join in the virtual world" />
</aui:button-row>
</aui:form> <liferay-util:include page="/navigation.jsp" servletContext="<%= application %>" /> <aui:script sandbox="<%= true %>">
var form = AUI.$(document.<portlet:namespace />fm); form.on(
'submit',
function(event) {
var redirect = form.fm('redirect'); if (redirect) {
var redirectVal = redirect.val(); redirect.val(redirectVal + window.location.hash);
} submitForm(form);
}
); form.fm('password').on(
'keypress',
function(event) {
Liferay.Util.showCapsLock(event, '<portlet:namespace />passwordCapsLockSpan');
}
);
</aui:script>
</c:otherwise>
</c:choose>

3.部署到Lifeay Portal上就可以看到你想要的效果啦,下面是效果图:

如何自定义Liferay 7 portal的Log in登录界面

完工啦,以后会陆续更新其他模板的使用,发现有好多模板呀,咦,还有一些我也不会用,还好,我们组里有一群大神,哈哈

如何自定义Liferay 7 portal的Log in登录界面的更多相关文章

  1. python&plus;selenium之自定义封装一个简单的Log类

    python+selenium之自定义封装一个简单的Log类 一. 问题分析: 我们需要封装一个简单的日志类,主要有以下内容: 1. 生成的日志文件格式是 年月日时分秒.log 2. 生成的xxx.l ...

  2. Python&plus;Selenium中级篇之8-Python自定义封装一个简单的Log类《转载》

    Python+Selenium中级篇之8-Python自定义封装一个简单的Log类: https://blog.csdn.net/u011541946/article/details/70198676

  3. server与Portal联合,portal许可过期无法登录。

    server与Portal联合,portal许可过期无法登录,怎样解除联合. 解决方案由峥姐友情提供~~ (1)删除有两种方式(①/②选其一即可): ①类似 链接ttps://sunl.esrichi ...

  4. FineReport中如何自定义登录界面

    在登录平台时,不希望使用FR默认的内置登录界面,想通过自定义登录界面实现登录操作,内置登录界面如下图: 登录界面,获取到用户名和密码的值,发送到报表系统,报表服务带着这两个参数访问认证地址进行认证. ...

  5. SpringSecurity学习二----------实现自定义登录界面

    © 版权声明:本文为博主原创文章,转载请注明出处 1.项目结构 2.pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0& ...

  6. ADFS登录界面自定义

    最近在做identityServer3+ADFS 实现域账号第三方授权验证,发现一个问题,在我们网站跳转到域账户登录页面,这个页面有点不美观,那么我们改如何自定义这个登录界面呢? ADFS安装配置这里 ...

  7. SpringCloud微服务实战——搭建企业级开发框架(二十六):自定义扩展OAuth2实现短信验证码登录

    现在手机验证码登录似乎是每个网站必备的功能,OAuth2支持扩展自定义授权模式,前面介绍了如何在系统集成短信通知服务,这里我们进行OAuth2的授权模式自定义扩展,使系统支持短信验证码登录. 1.在g ...

  8. Python之自定义封装一个简单的Log类

    参考:http://www.jb51.net/article/42626.htm 参考:http://blog.csdn.net/u011541946/article/details/70198676 ...

  9. 自定义信息丰富的Android Log

    [问题背景] 最近在项目上需要用LOG来查看和定位一些信息,但是系统原生的LOG实在太乱,信息也不太多,比如调用行数,所在方法,所在类名,线程名称都没有. [初步想法] 本着开源的精神,首先去GitH ...

随机推荐

  1. 【Cocos2d-x 3&period;x】 事件处理机制源码分析

    在游戏中,触摸是最基本的,必不可少的.Cocos2d-x 3.x中定义了一系列事件,同时也定义了负责监听这些事件的监听器,另外,cocos定义了事件分发类,用来将事件派发出去以便可以实现相应的事件. ...

  2. HTML5-表格

    表格:表头<caption>,行<tr>,列<td>,标题<th> 属性:cellpadding="10" cellspacing= ...

  3. F面经prepare:strstr变种

    * Given an integer k>=1 and two strings A and B (length ~n each); * Figure out if there is any co ...

  4. phpcms v9 源码解析(4)content模块下的index&period;php文件的init()方法解析

    在了解index.php中的init函数的时候,让我们先看看最开始的几行代码 1-5  第二行, defined('IN_PHPCMS') or exit('Nopermission resource ...

  5. SharePoint SiteCollection Administrator

    到网上去找怎么取到一个站点的sitecollection  Administrator, 如果设置了一个站点的 sitecollection  Administrator, 那么通过: SPSite ...

  6. selenium和pythond的区别

    selenium和pythond的区别 天宇6169 | 浏览 137 次 2016-03-18 10:25 2016-03-18 12:24 最佳答案   selenium ide是用来录制的!大概 ...

  7. C&num; 图解教程 第三章 类型、存储和变量

    类型.存储和变量 C#程序是一组类型声明类型是一种模板实例化类型数据成员和函数成员预定义类类型用户定义类型栈和堆 栈堆 值类型和引用类型 存储引用类型对象的成员C#类型的分类 变量静态类型和dynam ...

  8. Day2------字符编码

    复习: 系统启动流程:bios------->找到启动介质---------->把系统加载到内存------------>CPU执行 字符编码 一.字符串------------&g ...

  9. HBase学习——3&period;HBase表设计

    1.建表高级属性 建表过程中常用的shell命令 1.1 BLOOMFILTER 默认是 NONE 是否使用布隆过虑及使用何种方式,布隆过滤可以每列族单独启用 使用HColumnDescriptor. ...

  10. tomcat web漏洞整改--Apache Tomcat examples directory vulnerabilities

    在利用AWVS等弱扫工具对网站进行漏洞扫描时,经常会出现一些Tomcat漏洞问题,一般在弱扫报告中,都会给出简单的处理办法,但有时这些办法可能不太适合我们,或者在一些正式使用的环境中,不好操作,那么我 ...