liferay-portlet:login 登陸頁面的簡化

liferay-portlet:login 登陸頁面的簡化

 

一、dock中的登錄,去掉OpenID的:

       portal.properties中,搜索OpenID,把open.id.auth.enabled=true 改成open.id.auth.enabled=false

二、更改/webapps/ROOT/html/portlet/login 中的jsp文件,可以去掉新註冊用戶和記住密碼。

如果要更改dock中的登陸頁面,則修改/webapps/ROOT/html/portal中的login.jsp文件和login_create_account.jspf文件,可以去掉新註冊用戶和記住密碼等......

下邊是login.jsp文件

 <%
/**
 * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 =========================
 * Modify Copyright (c) 2010-3-18 sict, Inc 常英武 All rights reserved.
 * 註銷掉一些註冊賬號的功能
 */

%>

<%@ include file="/html/portal/init.jsp" %>

<%
String tabs1 = ParamUtil.getString(request, "tabs1", "already-registered");

String tabs1Names = "";
//String tabs1Names = "already-registered";
/**
if (company.isSendPassword()) {
 tabs1Names += ",forgot-password";
}

if (company.isStrangers()) {
 tabs1Names += ",create-account";
}

if (tabs1Names.equals("already-registered")) {
 tabs1Names = StringPool.BLANK;
}
**/

String redirect = ParamUtil.getString(request, "redirect");

PortletURL createAccountURL = themeDisplay.getURLCreateAccount();
%>

<c:if test="<%= SessionErrors.contains(request, PrincipalException.class.getName()) %>">
 <span class="portlet-msg-error">
 <liferay-ui:message key="you-have-attempted-to-access-a-section-of-the-site-that-requires-authentication" />
 <liferay-ui:message key="please-sign-in-to-continue" />
 </span>
</c:if>

<c:choose>
 <c:when test="<%= company.isSendPassword() %>">
  <liferay-ui:tabs
   names="<%= tabs1Names %>"
   url2="<%= createAccountURL.toString() %>"
   refresh="<%= false %>"
  >
   <liferay-ui:section>
    <%@ include file="/html/portal/login_create_account.jspf" %>
   </liferay-ui:section>
<!--
   <liferay-ui:section>
    <%@ include file="/html/portal/login_forgot_password.jspf" %>
   </liferay-ui:section>
-->

  </liferay-ui:tabs>
 </c:when>
 <c:otherwise>
  <liferay-ui:tabs
   names="<%= tabs1Names %>"
   url1="<%= createAccountURL.toString() %>"
   refresh="<%= false %>"
  >
<!--
   <liferay-ui:section>
    <%@ include file="/html/portal/login_create_account.jspf" %>
   </liferay-ui:section>

   <liferay-ui:section>
    <%@ include file="/html/portal/login_forgot_password.jspf" %>
   </liferay-ui:section>
-->

  </liferay-ui:tabs>
 </c:otherwise>
</c:choose>

<script type="text/javascript">
 <c:choose>
  <c:when test='<%= tabs1.equals("already-registered") %>'>
   Liferay.Util.focusFormField(document.fm1.login);
  </c:when>
  <c:when test='<%= tabs1.equals("forgot-password") %>'>
   Liferay.Util.focusFormField(document.fm3.emailAddress);
  </c:when>
 </c:choose>
</script>

=========================================================================================

下邊是:login_create_account.jspf

 <c:if test="<%= sectionSelected.booleanValue() %>">
 <c:if test='<%= SessionMessages.contains(request, "user_added") %>'>

  <%
  String emailAddress = (String)SessionMessages.get(request, "user_added");
  String password = (String)SessionMessages.get(request, "user_added_password");
  %>

  <span class="portlet-msg-success">

  <c:choose>
   <c:when test="<%= company.isStrangersVerify() || Validator.isNull(password) %>">
    <%= LanguageUtil.format(pageContext, "thank-you-for-creating-an-account-your-password-has-been-sent-to-x", emailAddress) %>
   </c:when>
   <c:otherwise>
    <%= LanguageUtil.format(pageContext, "thank-you-for-creating-an-account-your-password-is-x", new Object[] {password, emailAddress}) %>
   </c:otherwise>
  </c:choose>

  </span>
 </c:if>

 <c:if test="<%= SessionErrors.contains(request, AuthException.class.getName()) %>">
  <span class="portlet-msg-error">
  <liferay-ui:message key="authentication-failed" />
  </span>
 </c:if>

 <c:if test="<%= SessionErrors.contains(request, CookieNotSupportedException.class.getName()) %>">
  <span class="portlet-msg-error">
  <liferay-ui:message key="authentication-failed-please-enable-browser-cookies" />
  </span>
 </c:if>

 <c:if test="<%= SessionErrors.contains(request, NoSuchUserException.class.getName()) %>">
  <span class="portlet-msg-error">
  <liferay-ui:message key="please-enter-a-valid-login" />
  </span>
 </c:if>

 <c:if test="<%= SessionErrors.contains(request, PasswordExpiredException.class.getName()) %>">
  <span class="portlet-msg-error">
  <liferay-ui:message key="your-password-has-expired" />
  </span>
 </c:if>

 <c:if test='<%= SessionErrors.contains(request, UserEmailAddressException.class.getName()) %>'>
  <span class="portlet-msg-error">
  <liferay-ui:message key="please-enter-a-valid-login" />
  </span>
 </c:if>

 <c:if test='<%= SessionErrors.contains(request, UserLockoutException.class.getName()) %>'>
  <span class="portlet-msg-error">
  <liferay-ui:message key="this-account-has-been-locked" />
  </span>
 </c:if>

 <c:if test="<%= SessionErrors.contains(request, UserPasswordException.class.getName()) %>">
  <span class="portlet-msg-error">
  <liferay-ui:message key="please-enter-a-valid-password" />
  </span>
 </c:if>

 <c:if test="<%= SessionErrors.contains(request, UserScreenNameException.class.getName()) %>">
  <span class="portlet-msg-error">
  <liferay-ui:message key="please-enter-a-valid-screen-name" />
  </span>
 </c:if>
</c:if>

<c:if test="<%= SessionErrors.contains(request, AssociationException.class.getName()) %>">
 <span class="portlet-msg-error">
 <liferay-ui:message key="an-error-occurred-while-establishing-an-association-with-the-open-id-provider" />
 </span>
</c:if>

<c:if test="<%= SessionErrors.contains(request, ConsumerException.class.getName()) %>">
 <span class="portlet-msg-error">
 <liferay-ui:message key="an-error-occurred-while-initializing-the-open-id-consumer" />
 </span>
</c:if>

<c:if test="<%= SessionErrors.contains(request, DiscoveryException.class.getName()) %>">
 <span class="portlet-msg-error">
 <liferay-ui:message key="an-error-occurred-while-discovering-the-open-id-provider" />
 </span>
</c:if>

<c:if test="<%= SessionErrors.contains(request, MessageException.class.getName()) %>">
 <span class="portlet-msg-error">
 <liferay-ui:message key="an-error-occurred-while-communicating-with-the-open-id-provider" />
 </span>
</c:if>

<c:if test='<%= SessionErrors.contains(request, "missingOpenIdUserInformation") %>'>
 <span class="portlet-msg-error">
 <liferay-ui:message key="the-openid-provider-did-not-send-the-required-attributes" />
 </span>
</c:if>

<div class="lfr-portal-login">
 <form action="<%= themeDisplay.getPathMain() %>/portal/login" class="uni-form" method="post" name="fm1">
 <input name="<%= Constants.CMD %>" type="hidden" value="already-registered" />
 <input name="<%= sectionParam %>" type="hidden" value="already-registered" />
 <input name="redirect" type="hidden" value="<%= HtmlUtil.escape(redirect) %>" />

 <%
 String login = LoginAction.getLogin(request, "login", company);
 String passwordParam = SessionParameters.get(request, "password");
 boolean rememberMe = ParamUtil.getBoolean(request, "rememberMe");
 %>

 <input id="rememberMe" name="rememberMe" type="hidden" value="<%= rememberMe %>" />

 <fieldset class="block-labels">
  <c:choose>
   <c:when test="<%= OpenIdUtil.isEnabled(company.getCompanyId()) %>">
    <legend><liferay-ui:message key="sign-in-with-a-regular-account" /></legend>
   </c:when>
   <c:otherwise>
    <legend><liferay-ui:message key="sign-in" /></legend>
   </c:otherwise>
  </c:choose>

  <div class="ctrl-holder">
<!--原來的'login'翻譯爲'註冊',這裏就是登陸名,所以我把這個改成爲'ID'
          <label for="login"><liferay-ui:message key="login" /></label>
-->
   <label for="login"><liferay-ui:message key="ID" /></label>

   <input class="lfr-input-text" id="login" name="login" type="text" value="<%= HtmlUtil.escape(login) %>" />
  </div>

  <div class="ctrl-holder">
   <label for='<%= passwordParam %>'><liferay-ui:message key="password" /></label>

   <input class="lfr-input-text" id="<%= passwordParam %>" name="<%= passwordParam %>" type="password" value="" />

   <span id="passwordCapsLockSpan" style="display: none;"><liferay-ui:message key="caps-lock-is-on" /></span>
  </div>
<!--
  <c:if test="<%= company.isAutoLogin() && !PropsValues.SESSION_DISABLED %>">
   <div class="ctrl-holder inline-label">
    <label for="rememberMeCheckbox"><liferay-ui:message key="remember-me" /></label>

    <input <%= rememberMe ? "checked=/"checked/"" : "" %> id="rememberMeCheckbox" type="checkbox" />
   </div>
  </c:if>
-->

  <div class="button-holder">
   <input type="submit" value="<liferay-ui:message key="sign-in" />" />
  </div>
 </fieldset>

 </form>

 <c:if test="<%= OpenIdUtil.isEnabled(company.getCompanyId()) %>">

  <%
  String openId = ParamUtil.getString(request, "openId");
  %>

  <form action="<%= themeDisplay.getPathMain() %>/portal/open_id_request" class="uni-form" method="post" name="fm2">

  <fieldset class="block-labels">
   <legend><liferay-ui:message key="sign-in-with-an-open-id-provider" /></legend>

   <div class="ctrl-holder">
    <label for="openId"><liferay-ui:message key="open-id" /></label>

    <input class="openid_login" id="openId" name="openId" style="width: 150px;" type="text" value="<%= HtmlUtil.escape(openId) %>" />
   </div>

   <div class="button-holder">
    <input type="submit" value="<liferay-ui:message key="sign-in" />" />
   </div>
  </fieldset>

  </form>
 </c:if>
</div>

<script type="text/javascript">
 jQuery(
  function() {
   jQuery('#<%= passwordParam %>').keypress(
    function(event) {
     Liferay.Util.showCapsLock(event, 'passwordCapsLockSpan');
    }
   );

   jQuery('#rememberMeCheckbox').click(
    function() {
     var checked = 'off';

     if (this.checked) {
      checked = 'on';
     }

     jQuery('#rememberMe').val(checked);
    }
   );
  }
 );
</script>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章