Index: trunk/src/org/openstreetmap/josm/io/auth/JosmPreferencesCredentialAgent.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/auth/JosmPreferencesCredentialAgent.java	(revision 4691)
+++ trunk/src/org/openstreetmap/josm/io/auth/JosmPreferencesCredentialAgent.java	(revision 4692)
@@ -37,4 +37,7 @@
                 user = Main.pref.get("osm-server.username", null);
                 password = Main.pref.get("osm-server.password", null);
+            } else if(host != null) {
+                user = Main.pref.get("server.username."+host, null);
+                password = Main.pref.get("server.password."+host, null);
             } else {
                 user = null;
@@ -69,4 +72,11 @@
                 } else {
                     Main.pref.put("osm-server.password", String.valueOf(credentials.getPassword()));
+                }
+            } else if(host != null) {
+                Main.pref.put("server.username."+host, credentials.getUserName());
+                if (credentials.getPassword() == null) {
+                    Main.pref.put("server.password."+host, null);
+                } else {
+                    Main.pref.put("server.password."+host, String.valueOf(credentials.getPassword()));
                 }
             }
