Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Handle device_id returned from the fallback login page #520

Merged
merged 4 commits into from
Feb 28, 2019
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
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Changes in MatrixKit in 0.9.6 (2019-02-)
==========================================

Improvements:
* Upgrade MatrixSDK version ([v0.12.3](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.12.3)).

Bug fix:
* Handle device_id returned from the fallback login page (vector-im/riot-ios/issues/2301).

Changes in MatrixKit in 0.9.5 (2019-02-15)
==========================================

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,24 +119,26 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
if ([@"onRegistered" isEqualToString:parameters[@"action"]])
{
// Translate the JS registration event to MXCredentials
// We cannot use [MXCredentials modelFromJSON:] because of https://github.com/matrix-org/synapse/issues/4756
// Because of this issue, we cannot get the device_id allocated by the homeserver
// TODO: Fix it once the homeserver issue is fixed (filed at https://github.com/vector-im/riot-meta/issues/273).
MXCredentials *credentials = [[MXCredentials alloc] initWithHomeServer:parameters[@"homeServer"] userId:parameters[@"userId"] accessToken:parameters[@"accessToken"]];

// And inform the client
onSuccess(credentials);
}
else if ([@"onLogin" isEqualToString:parameters[@"action"]])
{
// Translate the JS login event to MXCredentials
NSString *homeServer = parameters[@"response"][@"home_server"];
NSString *userId = parameters[@"response"][@"user_id"];
NSString *accessToken = parameters[@"response"][@"access_token"];

MXCredentials *credentials;
MXJSONModelSetMXJSONModel(credentials, MXCredentials, parameters[@"response"]);

// Sanity check
if (homeServer.length && userId.length && accessToken.length)
if (credentials.homeServer.length && credentials.userId.length && credentials.accessToken.length)
{
MXCredentials *credentials = [[MXCredentials alloc] initWithHomeServer:homeServer userId:userId accessToken:accessToken];
// And inform the client
onSuccess(credentials);
}
}
}
}
return NO;
Expand Down