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

Commit

Permalink
Handle well-known data in the login response (#3002)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarty committed Mar 5, 2019
1 parent eeccdf9 commit 67d7130
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions vector/src/main/java/im/vector/LoginHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@

public class LoginHandler {
/**
* The account login / creation succeeds so create the dedicated session and store it.
* The account login succeeds so create the dedicated session and store it.
*
* @param appCtx the application context.
* @param hsConfig the homeserver config
* @param credentials the credentials
* @param callback the callback
*/
private void onRegistrationDone(Context appCtx,
HomeServerConnectionConfig hsConfig,
Credentials credentials,
ApiCallback<Void> callback) {
private void onLoginDone(Context appCtx,
HomeServerConnectionConfig hsConfig,
Credentials credentials,
ApiCallback<Void> callback) {
// sanity check - GA issue
if (TextUtils.isEmpty(credentials.userId)) {
callback.onMatrixError(new MatrixError(MatrixError.FORBIDDEN, "No user id"));
Expand Down Expand Up @@ -97,7 +97,7 @@ public void login(Context ctx,
callLogin(ctx, hsConfig, username, phoneNumber, phoneNumberCountry, password, new UnrecognizedCertApiCallback<Credentials>(hsConfig, callback) {
@Override
public void onSuccess(Credentials credentials) {
onRegistrationDone(appCtx, hsConfig, credentials, callback);
onLoginDone(appCtx, hsConfig, credentials, callback);
}

@Override
Expand Down Expand Up @@ -188,7 +188,7 @@ public void getSupportedRegistrationFlows(Context ctx,
@Override
public void onSuccess(Credentials credentials) {
// Should never happen, onMatrixError() will be called
onRegistrationDone(appCtx, hsConfig, credentials, callback);
onLoginDone(appCtx, hsConfig, credentials, callback);
}

@Override
Expand Down
10 changes: 5 additions & 5 deletions vector/src/main/java/im/vector/activity/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -749,12 +749,12 @@ private void onAutoDiscoveryRetrieved(String domain, AutoDiscovery.DiscoveredCli

if (AutoDiscovery.Action.PROMPT == info.getAction()) {
if (info.getWellKnown() == null) return;
if (info.getWellKnown().getHomeServer() == null) return;
final String hs = info.getWellKnown().getHomeServer().getBaseURL();
if (info.getWellKnown().homeServer == null) return;
final String hs = info.getWellKnown().homeServer.baseURL;
String ids = ServerUrlsRepository.INSTANCE.getDefaultIdentityServerUrl(LoginActivity.this);
if (info.getWellKnown().getIdentityServer() != null
&& !TextUtils.isEmpty(info.getWellKnown().getIdentityServer().getBaseURL())) {
ids = info.getWellKnown().getIdentityServer().getBaseURL();
if (info.getWellKnown().identityServer != null
&& !TextUtils.isEmpty(info.getWellKnown().identityServer.baseURL)) {
ids = info.getWellKnown().identityServer.baseURL;
}

if (hs != null) {
Expand Down

0 comments on commit 67d7130

Please sign in to comment.