From 0bda21b78215e6e8a78aeae839b075078187c73e Mon Sep 17 00:00:00 2001 From: Roger Yang Date: Thu, 25 Aug 2022 12:37:56 -0400 Subject: [PATCH] [fenix] Close https://github.com/mozilla-mobile/fenix/issues/21702: Update host name check in add login Co-Authored-By: joaopmatos <89925580+joaopmatos@users.noreply.github.com> --- .../fenix/settings/logins/fragment/AddLoginFragment.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/settings/logins/fragment/AddLoginFragment.kt b/app/src/main/java/org/mozilla/fenix/settings/logins/fragment/AddLoginFragment.kt index 0e9db6597a..e5c9dd9742 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/logins/fragment/AddLoginFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/logins/fragment/AddLoginFragment.kt @@ -9,11 +9,11 @@ import android.os.Bundle import android.text.Editable import android.text.InputType import android.text.TextWatcher +import android.util.Patterns import android.view.Menu import android.view.MenuInflater import android.view.MenuItem import android.view.View -import android.webkit.URLUtil import androidx.core.content.ContextCompat import androidx.core.view.isVisible import androidx.fragment.app.Fragment @@ -47,7 +47,7 @@ class AddLoginFragment : Fragment(R.layout.fragment_add_login) { private var duplicateLogin: SavedLogin? = null - private var validPassword = true + private var validPassword = false private var validUsername = true private var validHostname = false private var usernameChanged = false @@ -158,7 +158,7 @@ class AddLoginFragment : Fragment(R.layout.fragment_add_login) { setHostnameError() binding.clearHostnameTextButton.isEnabled = false } - !URLUtil.isHttpUrl(hostnameText) && !URLUtil.isHttpsUrl(hostnameText) -> { + !Patterns.WEB_URL.matcher(hostnameText).matches() -> { setHostnameError() binding.clearHostnameTextButton.isEnabled = true }