From 933ba143ff37bf129e58884fa76aaf62a695ed94 Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Fri, 16 Dec 2022 11:27:09 +0600 Subject: [PATCH] 5948-Fix_mail_not_configured_on_username_without_host_input issue: https://gitlab.e.foundation/e/backlog/-/issues/5948 `murena.io` account can have userName which is not email address. But, we want to have email as userName so that auth to services like Mail doesn't break. This commit add missing email host part in this type of case. --- .../ui/setup/EeloAuthenticatorFragment.kt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/src/main/java/at/bitfire/davdroid/ui/setup/EeloAuthenticatorFragment.kt b/app/src/main/java/at/bitfire/davdroid/ui/setup/EeloAuthenticatorFragment.kt index cfd3cbeab..eae04ab20 100644 --- a/app/src/main/java/at/bitfire/davdroid/ui/setup/EeloAuthenticatorFragment.kt +++ b/app/src/main/java/at/bitfire/davdroid/ui/setup/EeloAuthenticatorFragment.kt @@ -143,6 +143,21 @@ class EeloAuthenticatorFragment : Fragment() { super.onSaveInstanceState(outState) } + /** + * murena.io account can have userName which is not email address + * But, we want to have email as userName so that auth to services like Mail doesn't break. + * This method check the provided userName if it is not email & server is https://murena.io; + * then add `@murena.io` after the userName to make full email address. + */ + @SuppressLint("SetTextI18n") + private fun purifyUserName(serverUrl: String) { + val providedUserName = requireView().urlpwd_user_name.text.toString() + + if (!providedUserName.contains("@") && serverUrl == "https://${Constants.EELO_SYNC_HOST}") { + requireView().urlpwd_user_name.setText("$providedUserName@${Constants.EELO_SYNC_HOST}") + } + } + private fun computeDomain(username: CharSequence?) : String { var domain = "https://${Constants.EELO_SYNC_HOST}" @@ -192,6 +207,8 @@ class EeloAuthenticatorFragment : Fragment() { addSupportRetryOn401IfPossible(serverUrl) } + purifyUserName(serverUrl) + fun validateUrl() { model.baseUrlError.value = null -- GitLab