前提:

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)

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登录界面的更多相关文章

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

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

  2. Python+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. ado模版不会自动生成

    从数据库中更新模版的时候,其他文件都更新了,只有tt文件下的cs文件是没有更新的,没有添加也没有修改,在网上找了很久都没有这方面的信息. 其实只要删掉,重建一个ado模版就好.根本就不需要纠结.最后还 ...

  2. fitsSystemWindow作用

    fitsSystemWindows layout属性 英文文档注释为: Boolean internal attribute to adjust view layout based on system ...

  3. 安装ie10慢的解决办法

    下面是win7安装ie10的先决条件: http://support.microsoft.com/kb/2818833

  4. PropertyGrid排序

    解决PropertyGrid对自定义属性排序的问题. 参考了:http://www.cnblogs.com/greatverve/archive/2012/02/08/propergrid-order ...

  5. jquery动态移除/增加onclick属性详解

     本文章给大家介绍利用jquery的removeAttr与attr事件来给a标签增加与删除onclick事件的具体操作方法,有需要了解的朋友可参考. 要实现效果:点击链接先去掉onclick属性,3秒 ...

  6. 关于IIS中WEB网站访问弹“验证输入框”及“401限制访问”的解决办法

    最近在配置IIS网站的过程中,不管是本地还是外部访问配置的网站,出现了需要输入用户名.密码.及域的对话框,解决之后又出现页面401限制访问的错误页面. 就这两项错误,依次做一下解决办法的整理. 解决流 ...

  7. Regsvr32注册ActiveX控件

    命令:Regsvr32 XX.dll 注册ActiveX控件 Regsvr32命令参数:/u 卸载ActiveX控件/s 注册成功后不显示操作成功信息框/c 控制台输出/I 调用DllInstall安 ...

  8. 20150216—winform中的DataGridView

    DataGridView的主要作用是用来按列表来显示信息,其信息的数据源可以是SQL数据库,也可以是一个列表式的集合. DataGridView的位置:工具箱--数据--DataGridView.如下 ...

  9. Python 字典(Dictionary) setdefault()方法

    描述 Python 字典(Dictionary) setdefault() 函数和get()方法类似, 如果键不已经存在于字典中,将会添加键并将值设为默认值. 语法 setdefault()方法语法: ...

  10. java面试题小全

    面向对象的特征有哪些方面   1. 抽象:抽象就是忽略一个主题中与当前目标2. 无关的那些方面,3. 以便更充分地注意与当前目标4. 有关的方面.抽象并不5. 打算了解全部问题,而6. 只是选择其中的 ...