csierra
Posts: 123
|
Posted: 12/20/2009, 1:29 PM |
|
Hi, I am wondering how to implement a login from another URL; e.g. I have a front, public site, then I want to add a login form on that site, taht should only encrypt within a cookie and redirect to a subdomain wich is a completely different realm, and upon landing on that new subdomain, read from the cookie and validate the data, username and password; if not valid just do the processing and notigying.
Thanks for your advise
_________________
Yes! I Can!!! |
|
|
csierra
Posts: 123
|
Posted: 12/20/2009, 2:14 PM |
|
Now I have read a bit, we have CCloginUser function, and others; however I would like to go the ajax way, I am wondering how to build a service on subdomain that receives a request and returns a simple true or false, then on client side upon that, redirect to a page since the login has been already done. Any examples are greatly appreciated because i dont speak Java... Im learning...
Thank you
_________________
Yes! I Can!!! |
|
|
csierra
Posts: 123
|
Posted: 12/25/2009, 5:00 PM |
|
A bit annoyed because I have developed 2 pages, one for serving as authenticate and respond and one to consume:
The one that serves:
<!-- #INCLUDE VIRTUAL="/extranet/Common.asp"-->
<!-- #INCLUDE VIRTUAL="/extranet/Cache.asp" --><?xml version='1.0' encoding='ISO-8859-1'?>
<raiz>
<login>
<logged><%
Dim UID, PWORD, Result
UID = CCGetParam("UID", "guest")
PWORD = CCGetParam("PWORD", "passw0rd")
If UID = "guest" And PWORD = "passw0rd" Then
Result="False"
Else
'Validemos el Login
Result = CCLoginUser(UID, PWORD)
End If
Response.Write Result%></logged>
</login>
<login>
<logged>Algo aqui 1</logged>
</login>
<login>
<logged>Algo aqui 2</logged>
</login>
</raiz>
<%Response.End%>
This outputs this XML:
<?xml version='1.0' encoding='ISO-8859-1'?>
<raiz>
<login>
<logged>True</logged>
</login>
<login>
<logged>Algo aqui 1</logged>
</login>
<login>
<logged>Algo aqui 2</logged>
</login>
</raiz>
_________________
Yes! I Can!!! |
|
|
csierra
Posts: 123
|
Posted: 12/25/2009, 5:02 PM |
|
And we have the client:
<html>
<head>
<script type="text/javascript">
var xmlhttp;
function loadXMLDoc(url)
{
xmlhttp=null;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE5, IE6
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=onResponse;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
function onResponse()
{
if(xmlhttp.readyState!=4) return;
if(xmlhttp.status!=200)
{
alert("Problem retrieving XML data");
return;
}
_________________
Yes! I Can!!! |
|
|
|