[SPAM] - Re: AW: [opencms-dev] Login-Form and Redirect - Bayesian Filter detected spam

Fievet Marc Marc.Fievet at winterthur.be
Wed Aug 3 09:47:54 CEST 2005


Hello,

For the redirect, try this code:

<%@ page session="false" import="java.util.*,org.opencms.jsp.*" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>

<%
// get required OpenCms objects
CmsJspLoginBean cms = new CmsJspLoginBean(pageContext, request, response);

// Check for the template
String template = cms.property("template", "search");

// Insert the template head 
cms.include(template, "head"); 

// read parameters from the request
String username = request.getParameter("username");
String password = request.getParameter("password");
String action = request.getParameter("action");
String requestedResource = request.getParameter("requestedResource");

// read properties
String login_project = cms.property("login_project", "search");
String login_redirect = cms.property("login_redirect", "search");

	login_redirect = requestedResource;

// now process the login data
if ("logout".equals(action)) {
	cms.logout();
} else if ("login".equals(action)) {
	cms.login(username, password, login_project, login_redirect);
}

if (! cms.isLoggedIn()) {
// current user is not logged in - display the login form

	String message = "The Extranet area is protected.";
     
	if (! cms.isLoginSuccess()) {
		// previous login attempt was not successful
		message = "Login failed, please try again:";
	}
%>
<form action="<%= cms.getFormLink()
%>?requestedResource=<%=requestedResource%>" method="POST">

<table border="0" cellpadding="2" cellspacing="0">
<tr><td colspan="2"><%= message %></td><tr>
<br>
<br>
<tr><td>Username:</td><td><input name="username" size="25" value="<%=
username!=null?username:"" %>"></td></tr>
<tr><td>Password:</td><td><input name="password" size="25"
type="password"></td></tr>
<tr><td><input type="submit" value="Login"></td><td><input type="hidden"
name="action" value="login"></td></tr>
</table>

</form>
<%

} else {

// current user is already logged in - display the logout form
	String lien = cms.link(request.getParameter("requestedResource"));
	//System.out.println("ressource redirect :" + lien);

%>
<!--
	<html>
		<body>
			<form action="<%=lien%>" method="POST">
				<input type="submit" value="Voir"/>
			</form>
		</body>
	</html>
-->
<%
	
}
%>
<%
// Insert the template head 
cms.include(template, "foot");
%>


Regards,

MARC

-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Thomas Maerz
Sent: mardi 2 août 2005 14:46
To: The OpenCms mailing list
Subject: [SPAM] - Re: AW: [opencms-dev] Login-Form and Redirect - Bayesian
Filter detected spam


Oliver Adolph <Oliver.Adolph at intercard.de> writes:

> Do I have to set this property myself for every page ?

No, for protected pages OpenCms sends the user to a login page and passes
the uri for the original requested page via url parameter.

Pass the parameter yourself. 

> I think it should be
> set by OpenCMS to the original page.

No. Properties are set per page of folder and you are free to modify them.


Regards,
Thomas  



_______________________________________________
This mail is send to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://mail.opencms.org/mailman/listinfo/opencms-dev

______________________________________________


Winterthur-Europe Insurance - VAT BE 0403.290.168 RPM/RPR BRUSSELS.
This message may contain confidential, proprietary or legally privileged information and is intended only for the use of the addressee named above. No confidentiality or privilege is waived or lost by any mistransmission. If you are not the intended recipient of this message you are hereby notified that you must not use, disseminate, copy it in any form or take any action in reliance on it. If you have received this message in error please delete it and any copies of it and notify Winterthur immediately.This e-mail message and any attached files have been scanned for the presence of computer viruses. However, you are advised that you open any attachments at your own risk. 
The integrity and security of this message cannot be guaranteed on the Internet.





More information about the opencms-dev mailing list