ref #10461 try fix duplicate username handling (cont. II)
authorAndreas Müller <a.mueller@bgbm.org>
Wed, 24 Jan 2024 18:22:31 +0000 (19:22 +0100)
committerAndreas Müller <a.mueller@bgbm.org>
Wed, 24 Jan 2024 18:22:31 +0000 (19:22 +0100)
src/main/java/eu/etaxonomy/cdm/vaadin/view/AccountRegistrationPresenter.java
src/main/java/eu/etaxonomy/cdm/vaadin/view/AccountRegistrationView.java
src/main/java/eu/etaxonomy/cdm/vaadin/view/AccountRegistrationViewBean.java

index 4f6932ca09904e20c2b8536df79adba698b63ce6..d588732525cc545345bf116402af5dd8f23b5c92 100644 (file)
@@ -72,7 +72,7 @@ public class AccountRegistrationPresenter extends AbstractPresenter<AccountRegis
             List<String> viewParameters = getNavigationManager().getCurrentViewParameters();
             if(viewParameters.size() != 1  || !tokenStore.isEligibleToken(viewParameters.get(0))) {
                 // invalid token show error
-                getView().showErrorMessage("Invalid token");
+                getView().showErrorMessage("Invalid token", true);
             }
             Optional<AccountCreationRequest> resetRequestOpt = tokenStore.findRequest(viewParameters.get(0));
             if(resetRequestOpt.isPresent()) {
@@ -91,7 +91,7 @@ public class AccountRegistrationPresenter extends AbstractPresenter<AccountRegis
             String username = getView().getUserName().getValue();
             boolean existsAlready = repo.getUserService().userExists(username);
             if (existsAlready) {
-                getView().showErrorMessage("The username exists already, please try another username.");
+                getView().showErrorMessage("The username exists already, please try another username.", false);
                 return;
             }
 
@@ -119,13 +119,13 @@ public class AccountRegistrationPresenter extends AbstractPresenter<AccountRegis
                 if(asyncException.get(0) instanceof MailException) {
                     getView().showSuccessMessage("Your password has been changed but sending the confirmation email has failed.");
                 } else if(asyncException.get(0) instanceof AccountSelfManagementException) {
-                    getView().showErrorMessage("The password reset token has beceome invalid. Please request gain for a password reset.");
+                    getView().showErrorMessage("The password reset token has beceome invalid. Please request gain for a password reset.", true);
                 }
            } else {
                 if(!asyncTimeout && result) {
                     getView().showSuccessMessage("Your password has been changed and a confirmation email has been sent to you.");
                 } else {
-                    getView().showErrorMessage("A timeout has occured, please try again.");
+                    getView().showErrorMessage("A timeout has occured, please try again.", false);
                 }
             }
 
index beaa78ac441a01be896ab96b3e172be59937a955..85193fb80cdc02c681dcf7818d932f400726a5f1 100644 (file)
@@ -25,7 +25,7 @@ public interface AccountRegistrationView extends ApplicationView<AccountRegistra
 
     public void showSuccessMessage(String text);
 
-    public void showErrorMessage(String text);
+    public void showErrorMessage(String text, boolean disable);
 
     public TextField getEmailAddress();
 
index 45bbdf6fd2f6201892a6bf24762454393fc4f025..ac03a10149005bda992d924a15156502ef5a1af4 100644 (file)
@@ -122,11 +122,13 @@ public class AccountRegistrationViewBean
     }
 
     @Override
-    public void showErrorMessage(String text) {
+    public void showErrorMessage(String text, boolean disable) {
         messageLabel.setValue(text);
         messageLabel.setStyleName(ValoTheme.LABEL_FAILURE);
         messageLabel.setVisible(true);
-        disableForm();
+        if (disable) {
+            disableForm();
+        }
     }
 
     @Override