Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b95491ed authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

Merge branch '5948-Fix_mail_not_configured_on_username_without_host_input' into 'main'

5948-Fix_mail_not_configured_on_username_without_host_input

See merge request !86
parents 0e257d2f 8895f442
Loading
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -149,6 +149,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}"

@@ -198,6 +213,8 @@ class EeloAuthenticatorFragment : Fragment() {
            addSupportRetryOn401IfPossible(serverUrl)
        }

        purifyUserName(serverUrl)

        fun validateUrl() {

            model.baseUrlError.value = null