source: trunk/www/exception/not_logged_in.jsp @ 6632

Last change on this file since 6632 was 6632, checked in by Nicklas Nordborg, 8 years ago

References #1886: Extension point for "skinning" web gui

Adding support for re-mapping images to images provided by the skins. Basic support is added to the FixedSkinActionFactor which can be given a configuration parameter <image-remap-dir> that points to a path in the extension JAR file that simply mirrors the BASE web server (eg. /images directory) and re-maps images that are found.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.1 KB
Line 
1<%-- $Id: not_logged_in.jsp 6632 2014-11-28 10:28:38Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2005 Nicklas Nordborg
4  Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg
5  Copyright (C) 2007 Nicklas Nordborg
6
7  This file is part of BASE - BioArray Software Environment.
8  Available at http://base.thep.lu.se/
9
10  BASE is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public License
12  as published by the Free Software Foundation; either version 3
13  of the License, or (at your option) any later version.
14
15  BASE is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  GNU General Public License for more details.
19
20  You should have received a copy of the GNU General Public License
21  along with BASE. If not, see <http://www.gnu.org/licenses/>.
22  ------------------------------------------------------------------
23
24  This page is used to catch NotLoggedInExceptions which are
25  directed here via the exception.jsp page. NotLoggedInExceptions
26  happen when a user tries to access a protected page without beeing
27  logged in. Typically the exception is thrown from the method that
28  retrieves the BaseControl object:
29
30  BASE.getExistingBaseControl(pageContext);
31
32  This page will display a new login form allowing the user
33  to login again and continue with what he/she was doing.
34
35  @author Nicklas
36  @version 2.0
37--%>
38<%@ page pageEncoding="UTF-8" session="false"
39  import="net.sf.basedb.core.Application"
40  import="net.sf.basedb.core.SessionControl"
41  import="net.sf.basedb.core.DbControl"
42  import="net.sf.basedb.clients.web.Base"
43  import="net.sf.basedb.util.Values"
44  import="net.sf.basedb.util.extensions.ExtensionsInvoker"
45  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
46  import="net.sf.basedb.clients.web.extensions.JspContext"
47  import="net.sf.basedb.clients.web.extensions.login.LoginFormAction"
48  import="net.sf.basedb.clients.web.extensions.login.LoginFormBean"
49  import="net.sf.basedb.clients.web.extensions.login.FieldInfo"
50  isErrorPage="true"
51%>
52<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
53<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
54<%! 
55// If value is null, return "", else <prefix>+<value>+<suffix>
56String valueIfNotNull(String prefix, String value, String suffix)
57{
58  return value == null ? "" : prefix+value+suffix;
59}
60%>
61<%
62final SessionControl sc = Base.getSessionControl(pageContext, true);
63final String ID = sc.getId();
64final String root = request.getContextPath()+"/";
65final String redirect = Values.getString((String)request.getAttribute("redirect"));
66final DbControl dc = sc.newDbControl();
67
68try
69{
70  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext);
71  ExtensionsInvoker<LoginFormAction> invoker = (ExtensionsInvoker<LoginFormAction>)ExtensionsControl.useExtensions(jspContext, "net.sf.basedb.clients.web.login-form");
72  LoginFormAction loginAction = null;
73  for (LoginFormAction action : invoker)
74  {
75    if (action != null)
76    {
77      loginAction = action;
78      break;
79    }
80  }
81  if (loginAction == null)
82  {
83    LoginFormBean bean  = new LoginFormBean();
84    bean.setRememberLastLogin(true);
85    bean.setLoginField(FieldInfo.DEFAULT_LOGIN);
86    bean.setPasswordField(FieldInfo.DEFAULT_PASSWORD);
87    loginAction = bean;
88  }
89  FieldInfo loginField = loginAction.getLoginField();
90  FieldInfo passwordField = loginAction.getPasswordField();
91  %>
92  <base:page type="default" menu="exception" title="Not logged in">
93  <base:head scripts="exception.js,/login.js" styles="login.css">
94    <ext:scripts context="<%=jspContext%>" />
95    <ext:stylesheets context="<%=jspContext%>" />
96  </base:head>
97  <base:body data-resize-if-popup="1">
98 
99      <form action="<%=root%>login.jsp?again=1" method="post" name="login" target="Login">
100      <input type="hidden" name="ID" value="<%=ID%>">
101      <input type="hidden" name="redirect" value="<%=redirect%>">
102 
103      <table style="margin: auto; width: 700px; margin-top:5em; ">
104      <tr>
105      <td>
106        <%
107        if (loginAction.getHelp() != null)
108        {
109          %>
110          <div class="messagecontainer help" style="font-style: italic;" id="login-help">
111          <%=loginAction.getHelp() %>
112          </div>
113          <%
114        }
115        %>
116        <table style="width: 100%; margin-top: 1em; border-collapse: separate;">
117        <tr>
118          <td class="base-logo"><img src="images/baselogo.png" alt="BASE logo"></td>
119          <td style="width: 515px;">
120            <div id="loginform">
121            <table style="width: 100%;">
122              <tr <%=valueIfNotNull("class=\"", loginField.getClazz(), "\"")%> id="login-row">
123                <th class="bg-filled-100"><%=loginField.getPrompt() %></th>
124                <td colspan="2"><input class="text" name="login" id="login"
125                  type="<%=loginField.hasHiddenCharacters() ? "password" : "text"%>"
126                  value="" 
127                  <%=valueIfNotNull("style=\"", loginField.getStyle(), "\"") %>
128                  <%=valueIfNotNull("title=\"", loginField.getTooltip(), "\"") %>
129                  <%=valueIfNotNull("placeholder=\"", loginField.getPlaceHolder(), "\"") %>
130                  <%=loginAction.rememberLastLogin() ? "" : "autocomplete=\"off\" data-use-last-login=\"0\""%>
131                  maxlength="100" 
132                  tabindex="0">
133                </td>
134              </tr>
135              <tr <%=valueIfNotNull("class=\"", passwordField.getClazz(), "\"")%> id="password-row">
136                <th class="bg-filled-100"><%=passwordField.getPrompt() %></th>
137                <td><input class="text" name="password" id="password"
138                  type="<%=passwordField.hasHiddenCharacters() ? "password" : "text"%>"
139                  <%=valueIfNotNull("style=\"", passwordField.getStyle(), "\"") %>
140                  <%=valueIfNotNull("title=\"", passwordField.getTooltip(), "\"") %>
141                  <%=valueIfNotNull("placeholder=\"", passwordField.getPlaceHolder(), "\"") %>
142                  maxlength="80"
143                  tabindex="0">
144                </td>
145                <td>
146                  <base:buttongroup>
147                    <base:button id="btnLogin" image="login.png" title="Login" />
148                    <base:button id="close" title="Cancel" />
149                  </base:buttongroup>
150                </td>
151              </tr>
152              <tr>
153                <th class="bg-filled-100"></th>
154                <td colspan="2">
155                <%
156                String forgotPassword = sc.getClientDefaultSetting("server.forgotten.password");
157                String getAccount = sc.getClientDefaultSetting("server.get.account");
158                if (forgotPassword != null)
159                {
160                  %>
161                  <base:icon id="forgotPassword" image="bullet.png" 
162                    tooltip="Click here if you have forgotten your password">Forgot your password?</base:icon>
163                  <%
164                }
165                if (getAccount != null)
166                {
167                  %>
168                  <base:icon id="getAccount" image="bullet.png" 
169                    tooltip="Click here if you want to get an account on this server">Get an account!</base:icon>
170                  <%
171                }
172                %>
173                </td>
174              </tr>
175              </table>
176            </div>
177          </td>
178        </tr>
179        </table>
180 
181        <div class="messagecontainer error" id="timeout" style="display: none; margin-top: 1em;">
182          <b>Not logged in</b><br>
183          You have been automatically logged out due to inactivity or because the
184          server has been restarted.
185          You may log in again and continue your work but unsaved changes
186          may have been lost.
187        </div>
188 
189      </td>
190      </tr>
191      </table>
192 
193    </form>
194  </base:body>
195  </base:page>
196  <%
197}
198finally
199{
200  if (dc != null) dc.close();
201}
202%>
Note: See TracBrowser for help on using the repository browser.