Fixes #2405
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / dialogs / LoginDialog.java
index 5af54cabb4db93f5f9595126a37ae9b5bfec5836..51de1b0543615a1cb86683820a9f8fde36053517 100644 (file)
@@ -115,11 +115,16 @@ public class LoginDialog extends Dialog {
        
        @Override
        protected void cancelPressed() {                
-               boolean result = MessageDialog.openConfirm(getShell(), "Do you really want to cancel", "Aborting the login procedure will close the database.");
-               
-               if(result){
-                       CdmStore.close(StoreUtil.getMonitor());
+               if(CdmStore.getLoginManager().getAuthenticatedUser() != null){
                        super.cancelPressed();
+               }else{
+                       // if there is no active user and the current user chooses to cancel, we close the connection
+                       boolean result = MessageDialog.openConfirm(getShell(), "Do you really want to cancel", "Aborting the login procedure will close the database.");
+                       
+                       if(result){
+                               CdmStore.close(StoreUtil.getMonitor());
+                               super.cancelPressed();
+                       }
                }
        }
 }