X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/e0dc1e2b92bbdea32129ad9f62c242509fcb67cf..8b3c9f14dc08d799996da01f18ca369643a3c61d:/src/com/owncloud/android/authentication/AuthenticatorActivity.java diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index 32bbcdcc..fccd6154 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -828,9 +828,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener { * the root folder of the ownCloud server. */ private void checkBasicAuthorization() { - /// get the path to the root folder through WebDAV from the version server - String webdav_path = AccountUtils.getWebdavPath(mServerInfo.mVersion, mAuthTokenType); - /// get basic credentials entered by user String username = mUsernameInput.getText().toString(); String password = mPasswordInput.getText().toString(); @@ -844,18 +841,19 @@ SsoWebViewClientListener, OnSslUntrustedCertListener { String remotePath =""; boolean successIfAbsent = false; boolean followRedirects = true; - startExistenceCheckRemoteOperation(remotePath, this, successIfAbsent, webdav_path, username, password, followRedirects); + startExistenceCheckRemoteOperation( + remotePath, this, successIfAbsent, username, password, followRedirects); } - private void startExistenceCheckRemoteOperation(String remotePath, Context context, boolean successIfAbsent, String webdav_path, + private void startExistenceCheckRemoteOperation( + String remotePath, Context context, boolean successIfAbsent, String username, String password, boolean followRedirects) { Intent existenceCheckIntent = new Intent(); existenceCheckIntent.setAction(OperationsService.ACTION_EXISTENCE_CHECK); existenceCheckIntent.putExtra(OperationsService.EXTRA_SERVER_URL, mServerInfo.mBaseUrl); existenceCheckIntent.putExtra(OperationsService.EXTRA_REMOTE_PATH, remotePath); existenceCheckIntent.putExtra(OperationsService.EXTRA_SUCCESS_IF_ABSENT, successIfAbsent); - existenceCheckIntent.putExtra(OperationsService.EXTRA_WEBDAV_PATH, webdav_path); existenceCheckIntent.putExtra(OperationsService.EXTRA_USERNAME, username); existenceCheckIntent.putExtra(OperationsService.EXTRA_PASSWORD, password); existenceCheckIntent.putExtra(OperationsService.EXTRA_AUTH_TOKEN, mAuthToken); @@ -904,14 +902,12 @@ SsoWebViewClientListener, OnSslUntrustedCertListener { IndeterminateProgressDialog.newInstance(R.string.auth_trying_to_login, true); dialog.show(getSupportFragmentManager(), WAIT_DIALOG_TAG); - /// get the path to the root folder through WebDAV from the version server - String webdav_path = AccountUtils.getWebdavPath(mServerInfo.mVersion, mAuthTokenType); - /// test credentials accessing the root folder String remotePath =""; boolean successIfAbsent = false; boolean followRedirections = false; - startExistenceCheckRemoteOperation(remotePath, this, successIfAbsent, webdav_path, "", "", followRedirections); + startExistenceCheckRemoteOperation( + remotePath, this, successIfAbsent, "", "", followRedirections); } @@ -1284,8 +1280,7 @@ SsoWebViewClientListener, OnSslUntrustedCertListener { mWaitingForOpId = Long.MAX_VALUE; dismissDialog(WAIT_DIALOG_TAG); - String webdav_path = AccountUtils.getWebdavPath(mServerInfo.mVersion, mAuthTokenType); - if (result.isSuccess() && webdav_path != null) { + if (result.isSuccess()) { /// be gentle with the user IndeterminateProgressDialog dialog = IndeterminateProgressDialog.newInstance(R.string.auth_trying_to_login, true); @@ -1301,7 +1296,8 @@ SsoWebViewClientListener, OnSslUntrustedCertListener { String remotePath =""; boolean successIfAbsent = false; boolean followRedirects = true; - startExistenceCheckRemoteOperation(remotePath, this, successIfAbsent, webdav_path, "", "", followRedirects); + startExistenceCheckRemoteOperation( + remotePath, this, successIfAbsent, "", "", followRedirects); } else { updateAuthStatusIconAndText(result); @@ -1417,11 +1413,9 @@ SsoWebViewClientListener, OnSslUntrustedCertListener { String username = mUsernameInput.getText().toString().trim(); if (isOAuth) { username = "OAuth_user" + (new java.util.Random(System.currentTimeMillis())).nextLong(); - } - String accountName = username + "@" + uri.getHost(); - if (uri.getPort() >= 0) { - accountName += ":" + uri.getPort(); } + String accountName = com.owncloud.android.lib.common.accounts.AccountUtils. + buildAccountName(uri, username); Account newAccount = new Account(accountName, MainApp.getAccountType()); if (AccountUtils.exists(newAccount, getApplicationContext())) { // fail - not a new account, but an existing one; disallow