Index: lib/style/login.xsl
===================================================================
--- lib/style/login.xsl	(nonexistent)
+++ lib/style/login.xsl	(revision 510)
@@ -0,0 +1,101 @@
+<?xml version="1.0"?>
+<!--
+  * login.xsl
+  *
+  *      Authors: Jivka Bojilova
+  *    Copyright: 2000 Regents of the University of California and the 
+  *               National Center for Ecological Analysis and Synthesis
+  *  For Details: http://www.nceas.ucsb.edu/
+  *      Created: 2000 July 20
+  *    File Info: '$Id$' 
+  *
+  * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
+  * convert an XML file with information about login action
+  * into an HTML format suitable for rendering with modern web browsers.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+  <xsl:output method="html"/>
+
+  <xsl:template match="/">
+    <html>
+      <xsl:apply-templates name="login"/>
+    </html>
+  </xsl:template>
+
+  <xsl:template match="*" name="login">
+  <xsl:choose>
+
+    <xsl:when test="name(self::node())='login'">
+      <head>
+        <link rel="stylesheet" type="text/css" 
+              href="@html-path@/style/rowcol.css" />
+        <script language="JavaScript">
+          <![CDATA[
+          window.location="@html-path@/metacat.html"
+          ]]>
+        </script>
+      </head>
+      <body class="emlbody">
+	<noscript>
+          Please click <a href="@html-path@/metacat.html">here</a>
+          to enter Metacat. To disable this message in the future
+          please enable JavaScript on your browser.
+        </noscript>
+      </body>
+    </xsl:when>
+
+    <xsl:when test="name(self::node())='unauth_login'">
+      <head>
+        <link rel="stylesheet" type="text/css" 
+              href="@html-path@/style/rowcol.css" />
+        <script language="JavaScript">
+              <![CDATA[
+              window.location="@html-path@/login.html"
+              ]]>
+        </script>
+      </head>
+      <body class="emlbody">
+	<noscript>
+              Please click <a href="@html-path@/login.html">here</a>
+              to enter Metacat. To disable this message in the future
+              please enable JavaScript on your browser.
+        </noscript>
+      </body>
+    </xsl:when>
+
+    <xsl:when test="name(self::node())='logout'">
+      <head>
+        <link rel="stylesheet" type="text/css" 
+              href="@html-path@/style/rowcol.css" />
+        <script language="JavaScript">
+              <![CDATA[
+              window.location="@html-path@/index.html"
+              ]]>
+        </script>
+      </head>
+      <body class="emlbody">
+        <noscript>
+              Please click <a href="@html-path@/index.html">here</a>
+              to enter Metacat. To disable this message in the future
+              please enable JavaScript on your browser.
+        </noscript>
+      </body>
+    </xsl:when>
+
+    <xsl:when test="name(self::node())='error_login'">
+      <head>
+        <link rel="stylesheet" type="text/css" 
+              href="@html-path@/style/rowcol.css" />
+      </head>
+      <body class="emlbody">
+        <p style="color:red"> <b> Error Page </b> </p>
+        <p> <xsl:value-of select="message"/> </p>
+        <p> <a href="@html-path@/login.html">Try again</a> 
+            <a href="@html-path@/index.html">Continue</a>  </p>
+      </body>
+    </xsl:when>
+
+  </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>

Property changes on: lib/style/login.xsl
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: src/loadstylesheets.sql
===================================================================
--- src/loadstylesheets.sql	(revision 509)
+++ src/loadstylesheets.sql	(revision 510)
@@ -33,3 +33,9 @@
        VALUES ('XSL', '-//NCEAS//resource//EN', '-//W3C//HTML//EN',
                 '-//NCEAS//resource.xsl',
                 'http://dev.nceas.ucsb.edu/metadata/style/resource.xsl');
+INSERT INTO xml_catalog (entry_type, source_doctype, target_doctype,
+       public_id, system_id)
+       VALUES ('XSL', '-//NCEAS//login//EN', '-//W3C//HTML//EN',
+                '-//NCEAS//login.xsl',
+                'http://dev.nceas.ucsb.edu/metadata/style/login.xsl');
+
Index: src/edu/ucsb/nceas/metacat/AuthSession.java
===================================================================
--- src/edu/ucsb/nceas/metacat/AuthSession.java	(revision 509)
+++ src/edu/ucsb/nceas/metacat/AuthSession.java	(revision 510)
@@ -58,11 +58,13 @@
     try { 
       if ( authService.authenticate(username, password) ) {
         this.session = getSession(request, username, password);
-        message = "User Authentication successful";
-        this.statusMessage = formatOutput("success", message);
+        message = "Authentication successful for user: " + username;
+        this.statusMessage = formatOutput("login", message);
         return true;
       } else {  
         message = "Authentication failed for user: " + username;
+        this.statusMessage = formatOutput("unauth_login", message);
+        return false;
       }    
     } catch ( ConnectException ce ) {
       message = "Connection to the authentication service failed. " 
@@ -71,7 +73,7 @@
       message = ise.getMessage();
     }
  
-    this.statusMessage = formatOutput("error", message);
+    this.statusMessage = formatOutput("error_login", message);
     return false;
   }
 
@@ -145,13 +147,7 @@
       
     out.append("<?xml version=\"1.0\"?>\n");
     out.append("<" + tag + ">");
-    if ( tag.equals("error") ) {
-      out.append(message);
-    } else {
-      out.append("\n  <message>" + message + "</message>\n");
-      String username = (String)this.session.getAttribute("username");
-      out.append("  <username>" + username + "</username>\n");
-    }  
+    out.append("\n  <message>" + message + "</message>\n");
     out.append("</" + tag + ">");
     
     return out.toString();
Index: src/edu/ucsb/nceas/metacat/MetaCatServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 509)
+++ src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 510)
@@ -400,19 +400,8 @@
         conn = util.getConnection();
         DBTransform trans = new DBTransform(conn);
         response.setContentType("text/html");
-        // user authentication successful
-        if (isValid) {
-        //  trans.transformXMLDocument(sess.getMessage(), "-//NCEAS//login//EN",
-        //                             "-//W3C//HTML//EN", out);
-          response.sendRedirect(
-                   response.encodeRedirectUrl(htmlpath + "/metacat.html"));
-
-        // unsuccessful user authentication 
-        } else {
-        //  trans.transformXMLDocument(sess.getMessage(), "-//NCEAS//nologin//EN",
-        //                             "-//W3C//HTML//EN", out);
-          response.sendRedirect(htmlpath + "/login.html");
-        }
+        trans.transformXMLDocument(sess.getMessage(), "-//NCEAS//login//EN",
+                                   "-//W3C//HTML//EN", out);
         util.returnConnection(conn); 
       } catch(Exception e) {
         util.returnConnection(conn); 
@@ -423,29 +412,25 @@
       response.setContentType("text/xml");
       out.println(sess.getMessage()); 
     }
+        
+/* WITHOUT XSLT transformation
+    // redirects response to html page
+    if (qformat.equals("html")) {
+      // user authentication successful
+      if (isValid) {
+        response.sendRedirect(
+                 response.encodeRedirectUrl(htmlpath + "/metacat.html"));
+      // unsuccessful user authentication 
+      } else {
+        response.sendRedirect(htmlpath + "/login.html");
+      }
+    // any output is returned  
+    } else {
+      response.setContentType("text/xml");
+      out.println(sess.getMessage()); 
+    }
+*/        
 
-//    if (action.equals("Login Client")) {
-//      out.println(sess.getMessage());
-//    } else {
-//      try {
-//        if (isValid) {
-//          if (un.equals("public")) {
-//            response.sendRedirect(
-//                   response.encodeRedirectUrl(htmlpath + "/index.html"));
-//          } else {
-//            response.sendRedirect(
-//                   response.encodeRedirectUrl(htmlpath + "/metacat.html"));
-//          }
-//        } else {
-//          response.sendRedirect(htmlpath + "/login.html");
-//        }
-//      } catch ( java.io.IOException ioe) {
-//        String message = "handleLoginAction() - " +
-//                    "Error on redirect of HttpServletResponse: " + 
-//                    ioe.getMessage();
-//        out.println(message);
-//      }                
-//    }
   }    
 
   /** 
@@ -463,9 +448,9 @@
     // produce output
     StringBuffer output = new StringBuffer();
     output.append("<?xml version=\"1.0\"?>");
-    output.append("<success>");
-    output.append("User logout.");
-    output.append("</success>");
+    output.append("<logout>");
+    output.append("User logged out");
+    output.append("</logout>");
 
     //format and transform the output
     if (qformat.equals("html")) {
@@ -474,9 +459,8 @@
         conn = util.getConnection();
         DBTransform trans = new DBTransform(conn);
         response.setContentType("text/html");
-        //trans.transformXMLDocument(output, "-//NCEAS//logout//EN", 
-        //                           "-//W3C//HTML//EN", out);
-        response.sendRedirect(htmlpath + "/index.html"); 
+        trans.transformXMLDocument(output.toString(), "-//NCEAS//login//EN", 
+                                   "-//W3C//HTML//EN", out);
         util.returnConnection(conn); 
       } catch(Exception e) {
         util.returnConnection(conn); 
@@ -487,6 +471,19 @@
       out.println(output.toString()); 
     }
 
+/* WITHOUT XSLT transformation
+    // redirects response to html page
+    if (qformat.equals("html")) {
+        response.sendRedirect(htmlpath + "/index.html"); 
+      } catch(Exception e) {
+        util.returnConnection(conn); 
+      } 
+    // any output is returned  
+    } else {
+      response.setContentType("text/xml");
+      out.println(output.toString()); 
+    }
+*/
   }
 
   
