Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the json arguments of SyncUser.requestEmailConfirmation #5953

Merged
merged 3 commits into from
Oct 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
x.y.z Release notes (yyyy-MM-dd)
=============================================================
### Enhancements
* None.

### Fixed
* Fix `SyncUser.requestEmailConfirmation` not triggering the email confirmation
flow on ROS. (PR [#5953](https://github.com/realm/realm-cocoa/pull/5953), since 3.5.0)

### Compatibility
* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
* Realm Object Server: 3.11.0 or later.
* APIs are backwards compatible with all previous releases in the 3.x.y series.

3.11.0 Release notes (2018-10-04)
=============================================================

Expand Down Expand Up @@ -163,7 +177,7 @@ details.
### Deprecations

* `+[RLMSyncConfiguration initWithUser] has been deprecated in favor of `-[RLMSyncUser configurationWithURL:url].
* `+[RLMSyncConfiguration automaticConfiguration] has been deprecated in favor of `-[RLMSyncUser configuration].
* `+[RLMSyncConfiguration automaticConfiguration] has been deprecated in favor of `-[RLMSyncUser configuration].
* `+[RLMSyncConfiguration automaticConfigurationForUser] has been deprecated in favor of `-[RLMSyncUser configuration].
* `-[RLMSyncConfiguration isPartial] has been deprecated in favor of `-[RLMSyncConfiguration fullSynchronization]`.

Expand Down Expand Up @@ -2142,7 +2156,7 @@ Prebuilt frameworks are now built with Xcode 7.3.
`RLMRealm`/`Realm` instances.
* Fail with `RLMErrorFileNotFound` instead of the more generic `RLMErrorFileAccess`,
if no file was found when a realm was opened as read-only or if the directory part
of the specified path was not found when a copy should be written.
of the specified path was not found when a copy should be written.
* Greatly improve performance when deleting objects with one or more indexed
properties.
* Indexing `BOOL`/`Bool` and `NSDate` properties are now supported.
Expand Down Expand Up @@ -2177,7 +2191,7 @@ Prebuilt frameworks are now built with Xcode 7.3.

* Support for tvOS.
* Support for building Realm Swift from source when using Carthage.
* The block parameter of `-[RLMRealm transactionWithBlock:]`/`Realm.write(_:)` is
* The block parameter of `-[RLMRealm transactionWithBlock:]`/`Realm.write(_:)` is
now marked as `__attribute__((noescape))`/`@noescape`.
* Many forms of queries with key paths on both sides of the comparison operator
are now supported.
Expand Down
6 changes: 6 additions & 0 deletions Realm/ObjectServerTests/RLMObjectServerTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,10 @@ - (void)testRequestConfirmEmailForRegisteredUser {
RLMSyncCredentials *creds = [RLMSyncCredentials credentialsWithUsername:userName password:@"a" register:YES];
[[self logInUserForCredentials:creds server:[RLMObjectServerTests authServerURL]] logOut];

// This token is sent by ROS upon user registration
NSString *registrationToken = [self emailForAddress:userName];
XCTAssertNotNil(registrationToken);

XCTestExpectation *ex = [self expectationWithDescription:@"callback invoked"];
[RLMSyncUser requestEmailConfirmationForAuthServer:[RLMObjectServerTests authServerURL]
userEmail:userName completion:^(NSError *error) {
Expand All @@ -488,8 +492,10 @@ - (void)testRequestConfirmEmailForRegisteredUser {
}];
[self waitForExpectationsWithTimeout:2.0 handler:nil];

// This token should have been created when requestEmailConfirmationForAuthServer was called
NSString *token = [self emailForAddress:userName];
XCTAssertNotNil(token);
XCTAssertNotEqual(token, registrationToken);

// Use the token
ex = [self expectationWithDescription:@"callback invoked"];
Expand Down
3 changes: 1 addition & 2 deletions Realm/RLMSyncUser.mm
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,7 @@ + (void)requestEmailConfirmationForAuthServer:(NSURL *)serverURL
userEmail:(NSString *)email
completion:(RLMPasswordChangeStatusBlock)completion {
[RLMSyncUpdateAccountEndpoint sendRequestToServer:serverURL
JSON:@{@"data": @{@"provider_id": email,
@"action": @"request_email_confirmation"}}
JSON:@{@"provider_id": email, @"data": @{@"action": @"request_email_confirmation"}}
options:[[RLMSyncManager sharedManager] networkRequestOptions]
completion:completion];
}
Expand Down