source: branches/2.8-stable/www/logout.jsp @ 4506

Last change on this file since 4506 was 4506, checked in by Nicklas Nordborg, 14 years ago

References #118: Change problematic forms to use POST instead of GET

I have changed most of the forms I could find to use POST instead of GET. Many of them are probably not problematic, but I found some:

  • Form for JEP extra value calculator plug-in
  • Form for JEP intensity transformer plug-in
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.7 KB
Line 
1<%-- $Id: logout.jsp 4506 2008-09-11 09:29:40Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2005 Nicklas Nordborg
4  Copyright (C) 2006 Jari Hakkinen, Nicklas Nordborg
5
6  This file is part of BASE - BioArray Software Environment.
7  Available at http://base.thep.lu.se/
8
9  BASE is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License
11  as published by the Free Software Foundation; either version 3
12  of the License, or (at your option) any later version.
13
14  BASE is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  GNU General Public License for more details.
18
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place - Suite 330,
22  Boston, MA  02111-1307, USA.
23  ------------------------------------------------------------------
24
25  Logout from BASE.
26
27  @param noconfirm
28    If specified on the URL we display a confirmation dialogue
29    otherwise we just log out and forward to the /main.jsp page
30
31  @author Nicklas
32  @version 2.0
33--%>
34<%@ page session="false"
35  import="net.sf.basedb.core.SessionControl"
36  import="net.sf.basedb.core.User"
37  import="net.sf.basedb.util.Values"
38  import="net.sf.basedb.clients.web.Base"
39  import="net.sf.basedb.clients.web.WebException"
40  import="net.sf.basedb.clients.web.util.HTML"
41%>
42<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
43<%
44final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
45final String ID = sc.getId();
46final String noconfirm = request.getParameter("noconfirm");
47if (noconfirm != null)
48{
49  // Redirect to main login page
50  String redirect = "common/close_popup.jsp?ID="+ID+"&wait=0&redirect_opener=../main.jsp?ID="+ID;;
51  if (sc.isImpersonated())
52  {
53    SessionControl original = (SessionControl)sc.getSessionSetting("impersonate.originalSessionControl");
54    boolean revert = Values.getBoolean(request.getParameter("revert"));
55    if (revert)
56    {
57      redirect = "common/close_popup.jsp?ID="+original.getId()+"&wait=0&redirect_opener=../my_base/index.jsp?ID="+original.getId();
58    }
59    else
60    {
61      original.logout();
62    }
63  }
64  sc.logout();
65  response.sendRedirect(redirect);
66  return;
67}
68String title = sc.isImpersonated() ? "Logout impersonated?" : "Logout?";
69%>
70<base:page type="popup" title="<%=title%>">
71<base:head >
72  <script language="JavaScript">
73  function beginLogout()
74  {
75    Main.hide('confirm');
76    Main.show('logout');
77    setTimeout("document.forms['logout'].submit()", 800);
78  }
79  </script>
80</base:head>
81<base:body>
82  <br>
83  <form action="logout.jsp" method="post" name="logout" onsubmit="return false;">
84    <input type="hidden" name="ID" value="<%=ID%>">
85    <input type="hidden" name="noconfirm" value="1">
86 
87  <div id="confirm">
88    <base:note type="question" title="<%=title%>">
89      Are you sure you want to logout? All unsaved data will be lost!
90      <br>
91    </base:note>
92    <p>
93    <table align="center">
94    <tr>
95      <td colspan="2">
96      <% 
97      if (sc.isImpersonated())
98      {
99        User originalUser = (User)sc.getSessionSetting("impersonate.originalUser");
100        if (originalUser != null)
101        {
102          %>
103          <input type="checkbox" name="revert" value="1" checked>Revert to
104          <%=HTML.encodeTags(originalUser.getName())%>
105          <%
106        }
107      }
108      %>
109      </td>
110    </tr>
111    <tr>
112      <td width="50%"><base:button onclick="beginLogout()" title="Yes" /></td>
113      <td width="50%"><base:button onclick="window.close()" title="No" /></td>
114    </tr>
115    </table>
116  </div>
117 
118  <div id="logout" style="display: none;">
119    <base:note type="info" title="Logging out...">
120    Logging out...
121    </base:note>
122  </div>
123 
124  </form>
125
126</base:body>
127</base:page>
Note: See TracBrowser for help on using the repository browser.