From bc526a4d852131aadef618e663f54af83919721e Mon Sep 17 00:00:00 2001
From: ribeaudc <ribeaudc>
Date: Thu, 30 Oct 2008 12:02:10 +0000
Subject: [PATCH] fix: - 'LoginWidget' should reset its fields.

SVN: 8829
---
 .../DummyAuthenticationService.java              |  6 +++---
 .../web/client/application/ui/LoginWidget.java   | 16 +++++++++++++++-
 .../ui/sample_browser/SampleBrowserGrid.java     |  2 +-
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/authentication/source/java/ch/systemsx/cisd/authentication/DummyAuthenticationService.java b/authentication/source/java/ch/systemsx/cisd/authentication/DummyAuthenticationService.java
index a707616fb32..3a80df16ce4 100644
--- a/authentication/source/java/ch/systemsx/cisd/authentication/DummyAuthenticationService.java
+++ b/authentication/source/java/ch/systemsx/cisd/authentication/DummyAuthenticationService.java
@@ -38,14 +38,14 @@ public final class DummyAuthenticationService implements IAuthenticationService
     }
 
     /**
-     * Always returns <code>true</code>, meaning that the login was successfull.
+     * Always returns <code>true</code>, meaning that the login was successful.
      */
-    public final boolean authenticateUser(String applicationToken, String user, String password)
+    public final boolean authenticateUser(final String applicationToken, final String user, final String password)
     {
         return true;
     }
 
-    public final Principal getPrincipal(String applicationToken, String user)
+    public final Principal getPrincipal(final String applicationToken, final String user)
     {
         return new Principal(user, "John", "Doe", "franz-josef.elmer@systemsx.ch");
     }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/LoginWidget.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/LoginWidget.java
index c3b5b49ae2e..f1ea36610fe 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/LoginWidget.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/LoginWidget.java
@@ -162,11 +162,18 @@ public class LoginWidget extends VerticalPanel
         }
     }
 
+    public final void resetFields()
+    {
+        userField.reset();
+        passwordField.reset();
+        button.enable();
+    }
+
     //
     // Helper classes
     //
 
-    public static final class LoginCallback extends AbstractAsyncCallback<SessionContext>
+    public final class LoginCallback extends AbstractAsyncCallback<SessionContext>
     {
         private LoginCallback(final IViewContext<IGenericClientServiceAsync> viewContext)
         {
@@ -177,6 +184,12 @@ public class LoginWidget extends VerticalPanel
         // AbstractAsyncCallback
         //
 
+        @Override
+        protected final void finishOnFailure(final Throwable caught)
+        {
+            resetFields();
+        }
+
         @Override
         public final void process(final SessionContext sessionContext)
         {
@@ -200,6 +213,7 @@ public class LoginWidget extends VerticalPanel
             {
                 viewContext.getPageController().reload();
             }
+            resetFields();
         }
     }
 }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample_browser/SampleBrowserGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample_browser/SampleBrowserGrid.java
index f0d77cf12e9..688b771db69 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample_browser/SampleBrowserGrid.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample_browser/SampleBrowserGrid.java
@@ -390,7 +390,7 @@ public final class SampleBrowserGrid extends LayoutContainer
                             @Override
                             protected final void finishOnFailure(final Throwable caught)
                             {
-                                // callback.onFailure(caught);
+                                callback.onFailure(caught);
                             }
                         };
                 }
-- 
GitLab