- Timestamp:
- 2012-08-13T01:18:23+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/JosmUserIdentityManager.java
r5434 r5439 59 59 if (instance == null) { 60 60 instance = new JosmUserIdentityManager(); 61 instance.initFromPreferences(); 61 if (Main.pref.get("osm-server.auth-method").equals("oauth")) { 62 try { 63 instance.initFromOAuth(Main.parent); 64 } catch (Throwable t) { 65 t.printStackTrace(); 66 // Fall back to preferences if OAuth identification fails for any reason 67 instance.initFromPreferences(); 68 } 69 } else { 70 instance.initFromPreferences(); 71 } 62 72 Main.pref.addPreferenceChangeListener(instance); 63 73 } … … 67 77 private String userName; 68 78 private UserInfo userInfo; 79 private boolean accessTokenKeyChanged; 80 private boolean accessTokenSecretChanged; 69 81 70 82 private JosmUserIdentityManager() { … … 183 195 } 184 196 } else { 185 if ( !userName.equals(this.userName)) {197 if (userName != null && !userName.equals(this.userName)) { 186 198 setPartiallyIdentified(userName); 187 199 } else { … … 238 250 } 239 251 return; 240 } 241 242 if (evt.getKey().equals("osm-server.url")) { 252 253 } else if (evt.getKey().equals("osm-server.url")) { 243 254 if (!(evt.getNewValue() instanceof StringSetting)) return; 244 255 String newValue = ((StringSetting) evt.getNewValue()).getValue(); … … 248 259 setPartiallyIdentified(getUserName()); 249 260 } 261 262 } else if (evt.getKey().equals("oauth.access-token.key")) { 263 accessTokenKeyChanged = true; 264 265 } else if (evt.getKey().equals("oauth.access-token.secret")) { 266 accessTokenSecretChanged = true; 267 } 268 269 if (accessTokenKeyChanged && accessTokenSecretChanged) { 270 accessTokenKeyChanged = false; 271 accessTokenSecretChanged = false; 272 if (Main.pref.get("osm-server.auth-method").equals("oauth")) { 273 try { 274 instance.initFromOAuth(Main.parent); 275 } catch (Throwable t) { 276 t.printStackTrace(); 277 } 278 } 250 279 } 251 280 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManager.java
r5434 r5439 532 532 public void actionPerformed(ActionEvent arg0) { 533 533 JosmUserIdentityManager im = JosmUserIdentityManager.getInstance(); 534 if (Main.pref.get("osm-server.auth-method").equals("oauth")) { 535 im.initFromOAuth(ChangesetCacheManager.this); 536 } else { 537 im.initFromPreferences(); 538 if (im.isAnonymous()) { 539 alertAnonymousUser(); 540 return; 541 } 534 if (im.isAnonymous()) { 535 alertAnonymousUser(); 536 return; 542 537 } 543 538 ChangesetQuery query = new ChangesetQuery();
Note:
See TracChangeset
for help on using the changeset viewer.