# HG changeset patch # User Bjoern Ricks # Date 1342162353 0 # Node ID 16c71457ed43e10cdc6bb1a4360b171e1bcd4deb # Parent 3e0567e02577da2ef8bae29ad803f314a93269e7 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 diff -r 3e0567e02577 -r 16c71457ed43 flys-client/ChangeLog --- a/flys-client/ChangeLog Fri Jul 13 06:46:27 2012 +0000 +++ b/flys-client/ChangeLog Fri Jul 13 06:52:33 2012 +0000 @@ -1,3 +1,9 @@ +2012-07-13 Björn Ricks + + * src/main/webapp/login.jsp, + src/main/java/de/intevation/flys/client/server/LoginServlet.java: + Display exception details to the user if an authentication fails. + 2012-07-13 Björn Ricks * src/main/java/de/intevation/flys/client/server/auth/Authentication.java, diff -r 3e0567e02577 -r 16c71457ed43 flys-client/src/main/java/de/intevation/flys/client/server/LoginServlet.java --- 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); } } diff -r 3e0567e02577 -r 16c71457ed43 flys-client/src/main/webapp/login.jsp --- a/flys-client/src/main/webapp/login.jsp Fri Jul 13 06:46:27 2012 +0000 +++ b/flys-client/src/main/webapp/login.jsp Fri Jul 13 06:52:33 2012 +0000 @@ -8,6 +8,15 @@

FLYS Anmeldung

+ <% String error = request.getParameter("error"); %> + <% if (error != null) { %> +
+

Authentifizierung fehlgeschlagen

+
+ <%= error %> +
+
+ <% } %>
Bitte geben Sie eine Benutzerkennung und ein Passwort ein.