Project

General

Profile

« Previous | Next » 

Revision 328

Added by bojilova over 24 years ago

rearrange html pages for login and metacat access

View differences:

lib/metacat.html
1 1
<!--
2
  * index.html
2
  * metacat.html
3 3
  *
4 4
  *      Authors: Matt Jones
5 5
  *    Copyright: 2000 Regents of the University of California and the
lib/queform.html
36 36
  <option value="any">Any
37 37
  </select>
38 38
</form>
39
<a href="login.html" target="right">Login</a>
39
<a href="login.html" target="_top">Login</a>
40 40
</td>
41 41
<td valign="top">
42 42
<font size="-1">
lib/index.html
1 1
<!--
2
  * query.html
2
  * index.html
3 3
  *
4 4
  *      Authors: Jivka Bojilova
5 5
  *    Copyright: 2000 Regents of the University of California and the
src/edu/ucsb/nceas/metacat/MetaCatServlet.java
219 219
    }
220 220

  
221 221
// Jivka added  
222
    String username = null;
223 222
    // handle login action
224 223
    if (action.equals("Login") || action.equals("Login Client")) {
225 224
      handleLoginAction(out, params, request, response);
......
231 230
    // aware of session expiration on every request  
232 231
    } else {    
233 232
      HttpSession sess = request.getSession(false);
234
      //HttpSession sess = request.getSession(true);
235
      if (sess == null) { 
233
//      if (sess == null) { 
236 234
        // session expired or has not been stored b/w user requests
237
        // redirect to session expiration message page
238
        response.sendRedirect("/xmltodb/lib/sexpire.html"); 
239
      }
240
      username = (String)sess.getValue("username");
235
        // or anonymous user access with query privs only by default;
236
        // redirect to default page for query only access
237
//        response.sendRedirect("/xmltodb/lib/index.html"); 
238
//      } 
241 239
    }    
242 240
// End of Jivka added
243 241

  
......
252 250
        out.println(se.getMessage());
253 251
      }
254 252
    } else if (action.equals("insert") || action.equals("update")) {
255
      if ( username.equals("anonymous") ) {
256
        out.println("You are not authorized to use that option.");
257
      } else {
258
        handleInsertOrUpdateAction(out, params, response);
259
      }
253
      handleInsertOrUpdateAction(out, params, response);
260 254
    } else if (action.equals("delete")) {
261
      if ( username.equals("anonymous") ) {
262
        out.println("You are not authorized to use that option");
263
      } else {
264
        handleDeleteAction(out, params, response);
265
      }
255
      handleDeleteAction(out, params, response);
266 256
    } else if (action.equals("validate")) {
267
      if ( username.equals("anonymous") ) {
268
        out.println("You are not authorized to use that option");
269
      } else {
270
        handleValidateAction(out, params, response);  
271
      }
257
      handleValidateAction(out, params, response);  
272 258
    } else if (action.equals("getdatadoc")) {
273 259
      handleGetDataDocumentAction(out, params, response);  
274 260
    } else if (action.equals("getdoctypes")) {
......
304 290
      out.println(e.getMessage());
305 291
    }
306 292

  
307
    if ( un.equals("anonymous") ) {
308
        try {
309
            if (action.equals("Login Client")) {
310
                out.println("<?xml version=\"1.0\"?>");
311
                out.println("<success>");
312
                out.println("User Authentication successful.");
313
                out.println("</success>");
314
            } else {
315
                response.sendRedirect(
316
                response.encodeRedirectUrl("/xmltodb/lib/query.html"));
317
            }    
318
        } catch (java.io.IOException ioe) {
319
            sess.disconnect();            
320
            out.println("<?xml version=\"1.0\"?>");
321
            out.println("<error>");
322
            out.println("MetaCatServlet.handleLoginAction() - " +
323
                        "Error on redirect of HttpServletResponse: " + 
324
                        ioe.getMessage());
325
            out.println("</error>");
326
        }  
327
        
328
        return;
329
    }
330
    
331 293
    try { 
332 294
        if (sess.userAuth(un, pw)) {
333 295
            try {
......
822 784

  
823 785
/**
824 786
 * '$Log$
787
 * 'Revision 1.58  2000/08/04 23:34:09  bojilova
788
 * 'more precise handling of the Connection Pool
789
 * '
825 790
 * 'Revision 1.57  2000/08/03 23:20:31  bojilova
826 791
 * 'Changes related to "getdataguide" action
827 792
 * '

Also available in: Unified diff