diff flys-client/src/main/java/de/intevation/flys/client/server/LoginServlet.java @ 2969:16c71457ed43

Display error details to the user If an authentication fails the user should be informed about the reason. flys-client/trunk@4965 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Fri, 13 Jul 2012 06:52:33 +0000
parents d7f76f197d89
children b89dd09b486c
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/LoginServlet.java	Fri Jul 13 06:46:27 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/LoginServlet.java	Fri Jul 13 06:52:33 2012 +0000
@@ -23,6 +23,10 @@
         resp.sendRedirect("/login.jsp");
     }
 
+    private void redirectFailure(HttpServletResponse resp, Exception e) throws IOException {
+        resp.sendRedirect("/login.jsp?error=" + e.getMessage());
+    }
+
     private void redirectSuccess(HttpServletResponse resp, String uri) throws IOException {
         if (uri == null) {
             uri = "/FLYS.html";
@@ -65,8 +69,7 @@
             this.redirectSuccess(resp, uri);
         }
         catch(AuthenticationException e) {
-            //TODO User could not be authenticated
-            throw new ServletException(e);
+            this.redirectFailure(resp, e);
         }
     }
 

http://dive4elements.wald.intevation.org