\r
package com.owncloud.android.authentication;\r
\r
+import java.util.Locale;\r
+\r
import com.owncloud.android.MainApp;\r
-import com.owncloud.android.lib.accounts.AccountTypeUtils;\r
-import com.owncloud.android.lib.utils.OwnCloudVersion;\r
+import com.owncloud.android.lib.common.accounts.AccountTypeUtils;\r
+import com.owncloud.android.lib.resources.status.OwnCloudVersion;\r
\r
import android.accounts.Account;\r
import android.accounts.AccountManager;\r
MainApp.getAccountType());\r
\r
if (account != null && account.name != null) {\r
- for (Account ac : ocAccounts) {\r
- if (ac.name.equals(account.name)) {\r
+ int lastAtPos = account.name.lastIndexOf("@");\r
+ String hostAndPort = account.name.substring(lastAtPos + 1);\r
+ String username = account.name.substring(0, lastAtPos);\r
+ String otherHostAndPort, otherUsername;\r
+ Locale currentLocale = context.getResources().getConfiguration().locale;\r
+ for (Account otherAccount : ocAccounts) {\r
+ lastAtPos = otherAccount.name.lastIndexOf("@");\r
+ otherHostAndPort = otherAccount.name.substring(lastAtPos + 1);\r
+ otherUsername = otherAccount.name.substring(0, lastAtPos);\r
+ if (otherHostAndPort.equals(hostAndPort) &&\r
+ otherUsername.toLowerCase(currentLocale).\r
+ equals(username.toLowerCase(currentLocale))) {\r
return true;\r
}\r
}\r