|
| 1 | +<#include "../include/alfresco-template.ftl" /> |
| 2 | +<@templateHeader> |
| 3 | + <@link rel="stylesheet" type="text/css" href="${url.context}/res/themes/${theme}/login.css" /> |
| 4 | + <@script type="text/javascript" src="${page.url.context}/res/modules/simple-dialog.js"></@script> |
| 5 | +</@> |
| 6 | +<@templateBody> |
| 7 | + <div id="alflogin" class="login-panel"> |
| 8 | + <div class="login-logo"></div> |
| 9 | +<#if PORTLET> |
| 10 | + <div class="login-portlet">${msg("message.login-portal")}</div> |
| 11 | +<#else> |
| 12 | + <form id="loginform" accept-charset="UTF-8" method="post" action="${url.context}/page/dologin" onsubmit="return alfLogin();"> |
| 13 | + <fieldset> |
| 14 | + <div style="padding-top:86px"> |
| 15 | + <label id="txt-username" for="username"></label> |
| 16 | + </div> |
| 17 | + <div style="padding-top:4px"> |
| 18 | + <input type="text" id="username" name="username" maxlength="255" style="width:200px" value="<#if lastUsername??>${lastUsername?html}</#if>" /> |
| 19 | + </div> |
| 20 | + <div style="padding-top:8px"> |
| 21 | + <label id="txt-password" for="password"></label> |
| 22 | + </div> |
| 23 | + <div style="padding-top:4px"> |
| 24 | + <input type="password" id="password" name="password" maxlength="255" style="width:200px"/> |
| 25 | + </div> |
| 26 | + <div style="padding-top:12px"> |
| 27 | + <input type="submit" id="btn-login" class="login-button" /> |
| 28 | + </div> |
| 29 | + <div style="padding-top:16px"> |
| 30 | + <a id="link-forgotPass" href="#">${msg("link.forgotPass")}</a> |
| 31 | + </div> |
| 32 | + <input type="hidden" id="success" name="success" value="${successUrl?html}"/> |
| 33 | + <input type="hidden" name="failure" value="<#assign link>${url.context}/page/type/login</#assign>${link?html}?error=true"/> |
| 34 | + </fieldset> |
| 35 | + </form> |
| 36 | +</#if> |
| 37 | + <div style="padding-top:16px"> |
| 38 | + <span class="login-copyright"> |
| 39 | + © 2005-2010 Alfresco Software Inc. All rights reserved. |
| 40 | + </span> |
| 41 | + </div> |
| 42 | + </div> |
| 43 | + |
| 44 | + <script type="text/javascript">//<![CDATA[ |
| 45 | + function alfLogin() |
| 46 | + { |
| 47 | + YAHOO.util.Dom.get("btn-login").setAttribute("disabled", true); |
| 48 | + return true; |
| 49 | + } |
| 50 | + |
| 51 | + YAHOO.util.Event.onContentReady("alflogin", function() |
| 52 | + { |
| 53 | + var Dom = YAHOO.util.Dom; |
| 54 | + |
| 55 | + // Prevent the Enter key from causing a double form submission |
| 56 | + var form = Dom.get("loginform"); |
| 57 | + if (form) |
| 58 | + { |
| 59 | + // add the event to the form and make the scope of the handler this form. |
| 60 | + YAHOO.util.Event.addListener(form, "submit", this._submitInvoked, this, true); |
| 61 | + var fnStopEvent = function(id, keyEvent) |
| 62 | + { |
| 63 | + if (form.getAttribute("alflogin") == null) |
| 64 | + { |
| 65 | + form.setAttribute("alflogin", true); |
| 66 | + } |
| 67 | + } |
| 68 | +
|
| 69 | + var enterListener = new YAHOO.util.KeyListener(form, |
| 70 | + { |
| 71 | + keys: YAHOO.util.KeyListener.KEY.ENTER |
| 72 | + }, fnStopEvent, "keydown"); |
| 73 | + enterListener.enable(); |
| 74 | +
|
| 75 | + // set I18N labels |
| 76 | + Dom.get("txt-username").innerHTML = Alfresco.util.message("label.username") + ":"; |
| 77 | + Dom.get("txt-password").innerHTML = Alfresco.util.message("label.password") + ":"; |
| 78 | + Dom.get("btn-login").value = Alfresco.util.message("button.login"); |
| 79 | + } |
| 80 | + |
| 81 | + // generate and display main login panel |
| 82 | + var panel = new YAHOO.widget.Overlay(YAHOO.util.Dom.get("alflogin"), |
| 83 | + { |
| 84 | + modal: false, |
| 85 | + draggable: false, // NOTE: Don't change to "true" |
| 86 | + fixedcenter: true, |
| 87 | + close: false, |
| 88 | + visible: true, |
| 89 | + iframe: false |
| 90 | + }); |
| 91 | + panel.render(document.body); |
| 92 | + |
| 93 | + Dom.get("success").value += window.location.hash; |
| 94 | + Dom.get(<#if lastUsername??>"password"<#else>"username"</#if>).focus(); |
| 95 | + |
| 96 | + var resetPasswordDialog; |
| 97 | + |
| 98 | + // Forgot password link handler |
| 99 | + YAHOO.util.Event.addListener("link-forgotPass", "click", function(e) { |
| 100 | + var actionUrl = Alfresco.constants.PROXY_URI_RELATIVE.replace("/alfresco/", "/alfresco-noauth/") + "extras/modules/reset-user-password"; |
| 101 | + YAHOO.util.Event.stopEvent(e); |
| 102 | + if (!resetPasswordDialog) |
| 103 | + { |
| 104 | + resetPasswordDialog = new Alfresco.module.SimpleDialog("resetPasswordDialog").setOptions( |
| 105 | + { |
| 106 | + width: "30em", |
| 107 | + templateUrl: Alfresco.constants.URL_SERVICECONTEXT + "extras/modules/reset-password-dialog", |
| 108 | + actionUrl: actionUrl, |
| 109 | + onSuccess: |
| 110 | + { |
| 111 | + fn: function VideoWidget_onConfigFeed_callback(response) |
| 112 | + { |
| 113 | + Alfresco.util.PopupManager.displayMessage({ |
| 114 | + text: Alfresco.util.message("message.passwordSent") |
| 115 | + }); |
| 116 | + }, |
| 117 | + scope: this |
| 118 | + }, |
| 119 | + onFailure: |
| 120 | + { |
| 121 | + fn: function VideoWidget_onConfigFeed_callback(response) |
| 122 | + { |
| 123 | + var errorText = (response.json && response.json.message) ? |
| 124 | + response.json.message : Alfresco.util.message("message.unknownError"), |
| 125 | + errorTitle = (response.json && response.json.status && response.json.status.name) ? |
| 126 | + response.json.status.name : Alfresco.util.message("message.unknownErrorTitle"); |
| 127 | + |
| 128 | + Alfresco.util.PopupManager.displayPrompt({ |
| 129 | + title: errorTitle, |
| 130 | + text: errorText |
| 131 | + }); |
| 132 | + }, |
| 133 | + scope: this |
| 134 | + }, |
| 135 | + doSetupFormsValidation: |
| 136 | + { |
| 137 | + fn: function VideoWidget_doSetupForm_callback(form) |
| 138 | + { |
| 139 | + }, |
| 140 | + scope: this |
| 141 | + } |
| 142 | + }); |
| 143 | + } |
| 144 | + else |
| 145 | + { |
| 146 | + resetPasswordDialog.setOptions( |
| 147 | + { |
| 148 | + actionUrl: actionUrl |
| 149 | + }); |
| 150 | + } |
| 151 | + resetPasswordDialog.show(); |
| 152 | + }); |
| 153 | + }); |
| 154 | + |
| 155 | +<#if url.args["error"]??> |
| 156 | + Alfresco.util.PopupManager.displayPrompt( |
| 157 | + { |
| 158 | + title: Alfresco.util.message("message.loginfailure"), |
| 159 | + text: Alfresco.util.message("message.loginautherror"), |
| 160 | + buttons: [ |
| 161 | + { |
| 162 | + text: Alfresco.util.message("button.ok"), |
| 163 | + handler: function error_onOk() |
| 164 | + { |
| 165 | + this.destroy(); |
| 166 | + YAHOO.util.Dom.get("username").focus(); |
| 167 | + YAHOO.util.Dom.get("username").select(); |
| 168 | + }, |
| 169 | + isDefault: true |
| 170 | + }] |
| 171 | + }); |
| 172 | +
|
| 173 | +</#if> |
| 174 | + //]]></script> |
| 175 | +</@> |
| 176 | +</body> |
| 177 | +</html> |
0 commit comments