mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-23 21:50:31 +01:00
parent
115f25c0c1
commit
accbbdc9a7
@ -86,7 +86,7 @@ public class SwitchAccountController extends BaseController {
|
||||
public boolean onItemClick(View view, int position) {
|
||||
if (userItems.size() > position) {
|
||||
Account account = ((AdvancedUserItem) userItems.get(position)).getAccount();
|
||||
verifyAccount(account);
|
||||
reauthorizeFromImport(account);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -237,15 +237,11 @@ public class SwitchAccountController extends BaseController {
|
||||
swipeRefreshLayout.setEnabled(false);
|
||||
}
|
||||
|
||||
private void verifyAccount(Account account) {
|
||||
private void reauthorizeFromImport(Account account) {
|
||||
ImportAccount importAccount = AccountUtils.getInformationFromAccount(account);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(BundleKeys.KEY_USERNAME, importAccount.getUsername());
|
||||
bundle.putString(BundleKeys.KEY_TOKEN, importAccount.getToken());
|
||||
bundle.putString(BundleKeys.KEY_BASE_URL, importAccount.getBaseUrl());
|
||||
bundle.putBoolean(BundleKeys.KEY_IS_ACCOUNT_IMPORT, true);
|
||||
getRouter().pushController(RouterTransaction.with(new AccountVerificationController
|
||||
(bundle)).pushChangeHandler(new HorizontalChangeHandler())
|
||||
getRouter().pushController(RouterTransaction.with(new WebViewLoginController(importAccount.getBaseUrl(),
|
||||
false, importAccount.getUsername(), ""))
|
||||
.pushChangeHandler(new HorizontalChangeHandler())
|
||||
.popChangeHandler(new HorizontalChangeHandler()));
|
||||
}
|
||||
|
||||
|
@ -208,15 +208,20 @@ public class WebViewLoginController extends BaseController {
|
||||
basePageLoaded = true;
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(password)) {
|
||||
if (!TextUtils.isEmpty(username)) {
|
||||
if (loginStep == 1) {
|
||||
webView.loadUrl("javascript: {document.getElementsByClassName('login')[0].click(); };");
|
||||
} else if (!automatedLoginAttempted) {
|
||||
automatedLoginAttempted = true;
|
||||
webView.loadUrl("javascript: {" +
|
||||
"document.getElementById('user').value = '" + username + "';" +
|
||||
"document.getElementById('password').value = '" + password + "';" +
|
||||
"document.getElementById('submit').click(); };");
|
||||
if (TextUtils.isEmpty(password)) {
|
||||
webView.loadUrl("javascript: {" +
|
||||
"document.getElementById('user').value = '" + username + "'; };");
|
||||
} else {
|
||||
webView.loadUrl("javascript: {" +
|
||||
"document.getElementById('user').value = '" + username + "';" +
|
||||
"document.getElementById('password').value = '" + password + "';" +
|
||||
"document.getElementById('submit').click(); };");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user