mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-22 13:09:46 +01:00
Merge pull request #383 from nextcloud/fix-login
Fix credentials update when doing re-auth
This commit is contained in:
commit
252d93503c
@ -460,11 +460,6 @@ public class SettingsController extends BaseController {
|
|||||||
messageText.setText(getResources().getString(R.string.nc_settings_account_updated));
|
messageText.setText(getResources().getString(R.string.nc_settings_account_updated));
|
||||||
messageView.setVisibility(View.VISIBLE);
|
messageView.setVisibility(View.VISIBLE);
|
||||||
break;
|
break;
|
||||||
case WRONG_ACCOUNT:
|
|
||||||
messageText.setTextColor(getResources().getColor(R.color.nc_darkRed));
|
|
||||||
messageText.setText(getResources().getString(R.string.nc_settings_wrong_account));
|
|
||||||
messageView.setVisibility(View.VISIBLE);
|
|
||||||
break;
|
|
||||||
case SERVER_WITHOUT_TALK:
|
case SERVER_WITHOUT_TALK:
|
||||||
messageText.setTextColor(getResources().getColor(R.color.nc_darkRed));
|
messageText.setTextColor(getResources().getColor(R.color.nc_darkRed));
|
||||||
messageText.setText(getResources().getString(R.string.nc_settings_wrong_account));
|
messageText.setText(getResources().getString(R.string.nc_settings_wrong_account));
|
||||||
|
@ -71,7 +71,9 @@ import javax.inject.Inject;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import autodagger.AutoInjector;
|
import autodagger.AutoInjector;
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import io.requery.Persistable;
|
import io.requery.Persistable;
|
||||||
import io.requery.reactivex.ReactiveEntityStore;
|
import io.requery.reactivex.ReactiveEntityStore;
|
||||||
|
|
||||||
@ -323,12 +325,6 @@ public class WebViewLoginController extends BaseController {
|
|||||||
UserEntity currentUser = userUtils.getCurrentUser();
|
UserEntity currentUser = userUtils.getCurrentUser();
|
||||||
|
|
||||||
ApplicationWideMessageHolder.MessageType messageType = null;
|
ApplicationWideMessageHolder.MessageType messageType = null;
|
||||||
if (currentUser != null && isPasswordUpdate &&
|
|
||||||
!currentUser.getUsername().equals(loginData.getUsername())) {
|
|
||||||
ApplicationWideMessageHolder.getInstance().setMessageType(
|
|
||||||
ApplicationWideMessageHolder.MessageType.WRONG_ACCOUNT);
|
|
||||||
getRouter().popToRoot();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (!isPasswordUpdate && userUtils.getIfUserWithUsernameAndServer(loginData.getUsername(), baseUrl)) {
|
if (!isPasswordUpdate && userUtils.getIfUserWithUsernameAndServer(loginData.getUsername(), baseUrl)) {
|
||||||
messageType = ApplicationWideMessageHolder.MessageType.ACCOUNT_UPDATED_NOT_ADDED;
|
messageType = ApplicationWideMessageHolder.MessageType.ACCOUNT_UPDATED_NOT_ADDED;
|
||||||
@ -337,7 +333,12 @@ public class WebViewLoginController extends BaseController {
|
|||||||
if (userUtils.checkIfUserIsScheduledForDeletion(loginData.getUsername(), baseUrl)) {
|
if (userUtils.checkIfUserIsScheduledForDeletion(loginData.getUsername(), baseUrl)) {
|
||||||
ApplicationWideMessageHolder.getInstance().setMessageType(
|
ApplicationWideMessageHolder.getInstance().setMessageType(
|
||||||
ApplicationWideMessageHolder.MessageType.ACCOUNT_SCHEDULED_FOR_DELETION);
|
ApplicationWideMessageHolder.MessageType.ACCOUNT_SCHEDULED_FOR_DELETION);
|
||||||
|
|
||||||
|
if (!isPasswordUpdate) {
|
||||||
getRouter().popToRoot();
|
getRouter().popToRoot();
|
||||||
|
} else {
|
||||||
|
getRouter().popCurrentController();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationWideMessageHolder.MessageType finalMessageType = messageType;
|
ApplicationWideMessageHolder.MessageType finalMessageType = messageType;
|
||||||
@ -359,20 +360,23 @@ public class WebViewLoginController extends BaseController {
|
|||||||
if (!TextUtils.isEmpty(protocol)) {
|
if (!TextUtils.isEmpty(protocol)) {
|
||||||
bundle.putString(BundleKeys.KEY_ORIGINAL_PROTOCOL, protocol);
|
bundle.putString(BundleKeys.KEY_ORIGINAL_PROTOCOL, protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
getRouter().pushController(RouterTransaction.with(new AccountVerificationController
|
getRouter().pushController(RouterTransaction.with(new AccountVerificationController
|
||||||
(bundle)).pushChangeHandler(new HorizontalChangeHandler())
|
(bundle)).pushChangeHandler(new HorizontalChangeHandler())
|
||||||
.popChangeHandler(new HorizontalChangeHandler()));
|
.popChangeHandler(new HorizontalChangeHandler()));
|
||||||
} else {
|
} else {
|
||||||
if (isPasswordUpdate) {
|
if (isPasswordUpdate) {
|
||||||
if (currentUser != null) {
|
if (currentUser != null) {
|
||||||
userQueryDisposable = userUtils.createOrUpdateUser(null, null,
|
userQueryDisposable = userUtils.createOrUpdateUser(null, loginData.getToken(),
|
||||||
null, null, null, true,
|
null, null, null, true,
|
||||||
null, currentUser.getId(), null, appPreferences.getTemporaryClientCertAlias(), null).
|
null, currentUser.getId(), null, appPreferences.getTemporaryClientCertAlias(), null)
|
||||||
subscribe(userEntity -> {
|
.subscribeOn(Schedulers.newThread())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(userEntity -> {
|
||||||
if (finalMessageType != null) {
|
if (finalMessageType != null) {
|
||||||
ApplicationWideMessageHolder.getInstance().setMessageType(finalMessageType);
|
ApplicationWideMessageHolder.getInstance().setMessageType(finalMessageType);
|
||||||
}
|
}
|
||||||
getRouter().popToRoot();
|
getRouter().popCurrentController();
|
||||||
}, throwable -> dispose(),
|
}, throwable -> dispose(),
|
||||||
this::dispose);
|
this::dispose);
|
||||||
}
|
}
|
||||||
@ -386,7 +390,6 @@ public class WebViewLoginController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private LoginData parseLoginData(String prefix, String dataString) {
|
private LoginData parseLoginData(String prefix, String dataString) {
|
||||||
if (dataString.length() < prefix.length()) {
|
if (dataString.length() < prefix.length()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user