Commit e764d31d authored by Ricki Hirner's avatar Ricki Hirner

Login: Show error message when account name is already taken

parent 8d0d9200
Pipeline #42232107 passed with stages
in 9 minutes and 24 seconds
......@@ -81,6 +81,13 @@ class AccountDetailsFragment: Fragment() {
if (name.isEmpty())
v.account_name.error = getString(R.string.login_account_name_required)
else {
// check whether account name already exists
val am = AccountManager.get(requireActivity())
if (am.getAccountsByType(getString(R.string.account_type)).any { it.name == name }) {
v.account_name.error = getString(R.string.login_account_name_already_taken)
return@setOnClickListener
}
val idx = view!!.contact_group_method.selectedItemPosition
val groupMethodName = resources.getStringArray(R.array.settings_contact_group_method_values)[idx]
......
......@@ -159,6 +159,7 @@
<string name="login_account_name_info">Use your email address as account name because Android will use the account name as ORGANIZER field for events you create. You can\'t have two accounts with the same name.</string>
<string name="login_account_contact_group_method">Contact group method:</string>
<string name="login_account_name_required">Account name required</string>
<string name="login_account_name_already_taken">Account name already taken</string>
<string name="login_account_not_created">Account could not be created</string>
<string name="login_configuration_detection">Configuration detection</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment