mirror of
https://github.com/bitfireAT/davx5-ose
synced 2024-09-06 09:51:50 +00:00
Login: Show error message when account name is already taken
This commit is contained in:
parent
8d0d920033
commit
e764d31d18
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue