Changeset 4263 in josm for trunk/src/org
- Timestamp:
- 2011-07-25T00:48:51+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/JosmUserIdentityManager.java
r4246 r4263 10 10 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 11 11 import org.openstreetmap.josm.data.osm.UserInfo; 12 import org.openstreetmap.josm.io.auth.CredentialsManager; 12 13 import org.openstreetmap.josm.tools.CheckParameterUtil; 13 14 … … 168 169 */ 169 170 public void initFromPreferences() { 170 String userName = Main.pref.get("osm-server.username");171 String userName = CredentialsManager.getInstance().getUsername(); 171 172 if (isAnonymous()) { 172 173 if (userName != null && ! userName.trim().equals("")) { -
trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java
r4191 r4263 22 22 import org.openstreetmap.josm.gui.JMultilineLabel; 23 23 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 24 import org.openstreetmap.josm.io.auth.CredentialsManager; 24 25 import org.openstreetmap.josm.tools.CheckParameterUtil; 25 26 import org.openstreetmap.josm.tools.UrlLabel; … … 147 148 lblUser.setDescription(username); 148 149 } else { 149 String user = Main.pref.get("osm-server.username");150 String user = CredentialsManager.getInstance().getUsername(); 150 151 if (user == null) { 151 152 lblUser.setDescription(tr("anonymous")); -
trunk/src/org/openstreetmap/josm/gui/preferences/server/BasicAuthenticationPreferencesPanel.java
r4249 r4263 119 119 ); 120 120 cm.store(RequestorType.SERVER, pa); 121 // always save the username to the preferences if it isn't already saved there122 // by the credential manager123 if (! (cm instanceof JosmPreferencesCredentialAgent)) {124 Main.pref.put("osm-server.username", tfOsmUserName.getText().trim());125 }126 121 } catch(CredentialsAgentException e) { 127 122 e.printStackTrace(); -
trunk/src/org/openstreetmap/josm/io/GpxExporter.java
r3083 r4263 34 34 import org.openstreetmap.josm.gui.layer.Layer; 35 35 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 36 import org.openstreetmap.josm.io.auth.CredentialsManager; 36 37 import org.openstreetmap.josm.tools.CheckParameterUtil; 37 38 import org.openstreetmap.josm.tools.GBC; … … 84 85 JLabel emailLabel = new JLabel(tr("E-Mail")); 85 86 p.add(emailLabel, GBC.std().insets(10, 0, 5, 0)); 86 JTextField email = new JTextField(Main.pref.get("osm-server.username")); 87 String user = CredentialsManager.getInstance().getUsername(); 88 JTextField email = new JTextField(user == null ? "" : user); 87 89 p.add(email, GBC.eol().fill(GBC.HORIZONTAL)); 88 90 JLabel copyrightLabel = new JLabel(tr("Copyright (URL)")); … … 232 234 emailLabel.setEnabled(b); 233 235 authorName.setText(b ? Main.pref.get("lastAuthorName") : ""); 234 email.setText(b ? Main.pref.get("osm-server.username") : ""); 236 String user = CredentialsManager.getInstance().getUsername(); 237 email.setText(b ? (user == null ? "" : user) : ""); 235 238 236 239 boolean authorSet = authorName.getText().length() != 0; -
trunk/src/org/openstreetmap/josm/io/auth/CredentialsManager.java
r4249 r4263 7 7 8 8 import org.openstreetmap.josm.data.oauth.OAuthToken; 9 import org.openstreetmap.josm.gui.JosmUserIdentityManager; 10 import org.openstreetmap.josm.tools.Utils; 9 11 10 12 /** … … 63 65 } 64 66 67 public String getUsername() { 68 String username = null; 69 try { 70 PasswordAuthentication auth = lookup(RequestorType.SERVER); 71 if (auth != null) { 72 username = auth.getUserName(); 73 } 74 } catch (CredentialsAgentException ex) { 75 return null; 76 } 77 if (username == null) return null; 78 username = username.trim(); 79 return Utils.equal(username, "") ? null : username; 80 } 81 65 82 @Override 66 83 public PasswordAuthentication lookup(RequestorType requestorType) throws CredentialsAgentException { … … 70 87 @Override 71 88 public void store(RequestorType requestorType, PasswordAuthentication credentials) throws CredentialsAgentException { 89 if (requestorType == RequestorType.SERVER && credentials.getUserName() != null) { 90 JosmUserIdentityManager.getInstance().setPartiallyIdentified(credentials.getUserName()); 91 } 72 92 delegate.store(requestorType, credentials); 73 93 } -
trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
r4036 r4263 27 27 import org.openstreetmap.josm.io.OsmApiInitializationException; 28 28 import org.openstreetmap.josm.io.OsmTransferException; 29 import org.openstreetmap.josm.io.auth.CredentialsManager; 29 30 30 31 public class ExceptionUtil { … … 115 116 + "Please check the username and the password in the JOSM preferences." 116 117 + "</html>", 117 Main.pref.get("osm-server.username")118 CredentialsManager.getInstance().getUsername() 118 119 ); 119 120 }
Note:
See TracChangeset
for help on using the changeset viewer.