Skip to content

Commit

Permalink
fix: failed signup attempt with anonymous ParseUser leaves it in inco…
Browse files Browse the repository at this point in the history
…nsistent state (#1136)
  • Loading branch information
shlusiak authored Nov 10, 2021
1 parent 301c29b commit ac6d9e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions parse/src/main/java/com/parse/ParseUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -757,15 +757,15 @@ private Map<String, String> getAuthData(String authType) {

/* package */ void putAuthData(String authType, Map<String, String> authData) {
synchronized (mutex) {
Map<String, Map<String, String>> newAuthData = getAuthData();
Map<String, Map<String, String>> newAuthData = new HashMap<>(getAuthData());
newAuthData.put(authType, authData);
performPut(KEY_AUTH_DATA, newAuthData);
}
}

private void removeAuthData(String authType) {
synchronized (mutex) {
Map<String, Map<String, String>> newAuthData = getAuthData();
Map<String, Map<String, String>> newAuthData = new HashMap<>(getAuthData());
newAuthData.remove(authType);
performPut(KEY_AUTH_DATA, newAuthData);
}
Expand Down
2 changes: 1 addition & 1 deletion parse/src/test/java/com/parse/ParseUserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ public void testSaveAsyncWithLazyAndCurrentUser() throws Exception {
ParseTaskUtils.wait(partialMockUser.saveAsync("sessionToken", Task.<Void>forResult(null)));

// Make sure we clean authData
assertFalse(partialMockUser.getAuthData().containsKey("facebook"));
assertFalse(partialMockUser.getState().authData().containsKey("facebook"));
// Make sure we save new currentUser
verify(currentUserController, times(1)).setAsync(partialMockUser);
}
Expand Down

0 comments on commit ac6d9e0

Please sign in to comment.