|
@@ -785,8 +785,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
Intent getServerInfoIntent = new Intent();
|
|
|
getServerInfoIntent.setAction(OperationsService.ACTION_GET_SERVER_INFO);
|
|
|
getServerInfoIntent.putExtra(
|
|
|
- OperationsService.EXTRA_SERVER_URL,
|
|
|
- normalizeUrlSuffix(uri)
|
|
|
+ OperationsService.EXTRA_SERVER_URL,
|
|
|
+ normalizeUrlSuffix(uri)
|
|
|
);
|
|
|
if (mOperationsServiceBinder != null) {
|
|
|
mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(getServerInfoIntent);
|
|
@@ -999,7 +999,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
|
|
|
if ( mAction == ACTION_CREATE) {
|
|
|
mUsernameInput.setText(username);
|
|
|
- success = createAccount();
|
|
|
+ success = createAccount(result);
|
|
|
} else {
|
|
|
|
|
|
if (!mUsernameInput.getText().toString().equals(username)) {
|
|
@@ -1351,8 +1351,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
Log_OC.d(TAG, "Successful access - time to save the account");
|
|
|
|
|
|
boolean success = false;
|
|
|
+
|
|
|
if (mAction == ACTION_CREATE) {
|
|
|
- success = createAccount();
|
|
|
+ success = createAccount(result);
|
|
|
|
|
|
} else {
|
|
|
try {
|
|
@@ -1449,13 +1450,18 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
*
|
|
|
* TODO Decide how to name the OAuth accounts
|
|
|
*/
|
|
|
- private boolean createAccount() {
|
|
|
+ private boolean createAccount(RemoteOperationResult authResult) {
|
|
|
/// create and save new ownCloud account
|
|
|
boolean isOAuth = AccountTypeUtils.
|
|
|
getAuthTokenTypeAccessToken(MainApp.getAccountType()).equals(mAuthTokenType);
|
|
|
boolean isSaml = AccountTypeUtils.
|
|
|
getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(mAuthTokenType);
|
|
|
|
|
|
+ String lastPermanentLocation = authResult.getLastPermanentLocation();
|
|
|
+ if (lastPermanentLocation != null) {
|
|
|
+ mServerInfo.mBaseUrl = AccountUtils.trimWebdavSuffix(lastPermanentLocation);
|
|
|
+ }
|
|
|
+
|
|
|
Uri uri = Uri.parse(mServerInfo.mBaseUrl);
|
|
|
String username = mUsernameInput.getText().toString().trim();
|
|
|
if (isOAuth) {
|
|
@@ -1513,7 +1519,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
/// add user data to the new account; TODO probably can be done in the last parameter
|
|
|
// addAccountExplicitly, or in KEY_USERDATA
|
|
|
mAccountMgr.setUserData(
|
|
|
- mAccount, Constants.KEY_OC_VERSION, mServerInfo.mVersion.getVersion()
|
|
|
+ mAccount, Constants.KEY_OC_VERSION, mServerInfo.mVersion.getVersion()
|
|
|
);
|
|
|
mAccountMgr.setUserData(
|
|
|
mAccount, Constants.KEY_OC_BASE_URL, mServerInfo.mBaseUrl
|