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