\r
if ( mAction == ACTION_CREATE) {\r
mUsernameInput.setText(username);\r
- success = createAccount();\r
+ success = createAccount(result);\r
} else {\r
\r
if (!mUsernameInput.getText().toString().equals(username)) {\r
Log_OC.d(TAG, "Successful access - time to save the account");\r
\r
boolean success = false;\r
+\r
if (mAction == ACTION_CREATE) {\r
- success = createAccount();\r
+ success = createAccount(result);\r
\r
} else {\r
try {\r
* \r
* TODO Decide how to name the OAuth accounts\r
*/\r
- private boolean createAccount() {\r
+ private boolean createAccount(RemoteOperationResult authResult) {\r
/// create and save new ownCloud account\r
boolean isOAuth = AccountTypeUtils.\r
getAuthTokenTypeAccessToken(MainApp.getAccountType()).equals(mAuthTokenType);\r
boolean isSaml = AccountTypeUtils.\r
getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(mAuthTokenType);\r
\r
+ String lastPermanentLocation = authResult.getLastPermanentLocation();\r
+ if (lastPermanentLocation != null) {\r
+ mServerInfo.mBaseUrl = AccountUtils.trimWebdavSuffix(lastPermanentLocation);\r
+ }\r
+\r
Uri uri = Uri.parse(mServerInfo.mBaseUrl);\r
String username = mUsernameInput.getText().toString().trim();\r
if (isOAuth) {\r
/// add user data to the new account; TODO probably can be done in the last parameter \r
// addAccountExplicitly, or in KEY_USERDATA\r
mAccountMgr.setUserData(\r
- mAccount, Constants.KEY_OC_VERSION, mServerInfo.mVersion.getVersion()\r
+ mAccount, Constants.KEY_OC_VERSION, mServerInfo.mVersion.getVersion()\r
);\r
mAccountMgr.setUserData(\r
mAccount, Constants.KEY_OC_BASE_URL, mServerInfo.mBaseUrl\r