2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-15 18:12:54 +00:00

Bug 1815632 - Adds https to non-http(s) protocols when adding new login

This commit is contained in:
gitstart 2023-08-10 06:12:58 +00:00 committed by mergify[bot]
parent 2a395a7b0c
commit 697839c07f

View File

@ -24,6 +24,7 @@ import androidx.navigation.fragment.findNavController
import mozilla.components.lib.state.ext.consumeFrom
import mozilla.components.support.ktx.android.view.hideKeyboard
import mozilla.components.support.ktx.android.view.showKeyboard
import mozilla.components.support.ktx.util.URLStringUtils
import org.mozilla.fenix.GleanMetrics.Logins
import org.mozilla.fenix.R
import org.mozilla.fenix.components.StoreProvider
@ -371,7 +372,13 @@ class AddLoginFragment : Fragment(R.layout.fragment_add_login), MenuProvider {
R.id.save_login_button -> {
view?.hideKeyboard()
interactor.onAddLogin(
binding.hostnameText.text.toString(),
with(binding.hostnameText.text.toString()) {
if (URLStringUtils.isHttpOrHttps(this)) {
this
} else {
"$HTTPS$this"
}
},
binding.usernameText.text.toString(),
binding.passwordText.text.toString(),
)
@ -385,4 +392,8 @@ class AddLoginFragment : Fragment(R.layout.fragment_add_login), MenuProvider {
super.onDestroyView()
_binding = null
}
companion object {
private const val HTTPS = "https://"
}
}