ref #6190 removing svn property place holder in first line of code - java files
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / store / LoginManager.java
index 79f06e52435f2816aad730342610f69f7ee5a336..6df774bfa7ff10d66e23091447c3bb3168b6005c 100644 (file)
@@ -1,4 +1,3 @@
-// $Id$
 /**
 * Copyright (C) 2007 EDIT
 * European Distributed Institute of Taxonomy
@@ -46,8 +45,12 @@ public class LoginManager extends Observable implements IConversationEnabled, IC
 
        private ConversationHolder conversation;
 
+       public static final String INCORRECT_CREDENTIALS_MESSAGE = "Login and/or Password incorrect";
+       public static final String ACCOUNT_LOCKED_MESSAGE = "Account is locked";
+       public static final String EMPTY_CREDENTIALS_MESSAGE = "Login and/or Password empty";
+
        public LoginManager(){
-               CdmStore.getContextManager().addContextListener(this);
+           CdmStore.getContextManager().addContextListener(this);
        }
 
        /**
@@ -68,6 +71,7 @@ public class LoginManager extends Observable implements IConversationEnabled, IC
                doAuthenticate(username, password);
            } catch (CdmAuthenticationException e) {
                MessagingUtils.warningDialog("Could not authenticate", this, e.getMessage());
+               return false;
         }
            return true;
        }
@@ -106,15 +110,16 @@ public class LoginManager extends Observable implements IConversationEnabled, IC
                    this.notifyObservers();
                }
            } catch(BadCredentialsException e){
-               throw new CdmAuthenticationException("Login and/or Password incorrect", e);
+               throw new CdmAuthenticationException(INCORRECT_CREDENTIALS_MESSAGE, e);
            } catch(LockedException e){
-               throw new CdmAuthenticationException("Account is locked", e);
+               throw new CdmAuthenticationException(ACCOUNT_LOCKED_MESSAGE, e);
            } catch(IllegalArgumentException e){
-               throw new CdmAuthenticationException("Login and/or Password empty", e);
+               throw new CdmAuthenticationException(EMPTY_CREDENTIALS_MESSAGE, e);
            }
 
        }
 
+
        private void _logGrantedAuthotities(StringBuilder gaText, String indent,
                        Set<GrantedAuthority> gaSet) {
                for(GrantedAuthority ga : gaSet){