前提:

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. MarkDown认识与入门

    Markdown 是一种轻量级的「标记语言」,它的优点很多,目前也被越来越多的写作爱好者,撰稿者广泛使用.看到这里请不要被「标记」.「语言」所迷惑,Markdown 的语法十分简单.常用的标记符号也不 ...

  2. 了解ASP.NET MVC几种ActionResult的本质:HttpStatusCodeResult & RedirectResult/RedirectToRouteResult

    在本系列的最后一篇,我们来讨论最后三个ActionResult:HttpStatusCodeResult.RedirectResult和RedirectToRouteResult .第一个用于实现针对 ...

  3. webkit常见问题汇总

    前段时间有人问我一个简单的问题,html如何创建解析的? 我讲了一大堆,什么通过DocumentLoader, CachedResourceLoader, CacheResource, Resourc ...

  4. asp.net C#生成和解析二维码代码

    类库文件我们在文件最后面下载 [ThoughtWorks.QRCode.dll 就是类库] 使用时需要增加: using ThoughtWorks.QRCode.Codec;using Thought ...

  5. Exchange之三合一部署

          1.         前期准备条件之安装filter包   2.         前期准备之安装组件,命令如下 Add-WindowsFeature NET-Framework,RSAT- ...

  6. UIAlertView[警告框] [代理协议型]UIActionSheet [表单视图][代理协议型]

    ////  ViewController.h//  UIAlertViewAndUIActionSheet////  Created by hehe on 15/9/21.//  Copyright ...

  7. UI4_UIStepper与UIProgressView

    // // ViewController.m // UI4_UIStepper与UIProgressView // // Created by zhangxueming on 15/7/7. // C ...

  8. (转)RabbitMQ消息队列(五):Routing 消息路由

    上篇文章中,我们构建了一个简单的日志系统.接下来,我们将丰富它:能够使用不同的severity来监听不同等级的log.比如我们希望只有error的log才保存到磁盘上. 1. Bindings绑定 上 ...

  9. Linux中profile与bashrc的作用

    文章同步发表在博主网站朗度云,传输门:http://www.wolfbe.com/detail/201608/278.html 在Linux系统上,我们会看到类似于profile和bashrc的文件, ...

  10. ubuntu设置关闭屏幕和锁定

    见链接:http://askubuntu.com/questions/177348/how-do-i-disable-the-screensaver-lock If you want to wrap ...