mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-21 17:05:39 +03:00
Temporary fix to show error when user is creating an account on matrix.org with userId containing only digits (#1410)
This commit is contained in:
parent
55bd346cb2
commit
0fd50892af
3 changed files with 10 additions and 3 deletions
|
@ -1,9 +1,6 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<option name="RIGHT_MARGIN" value="160" />
|
||||
<AndroidXmlCodeStyleSettings>
|
||||
<option name="ARRANGEMENT_SETTINGS_MIGRATED_TO_191" value="true" />
|
||||
</AndroidXmlCodeStyleSettings>
|
||||
<JetCodeStyleSettings>
|
||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||
<value>
|
||||
|
|
|
@ -11,6 +11,7 @@ Improvements 🙌:
|
|||
|
||||
Bugfix 🐛:
|
||||
- Switch theme is not fully taken into account without restarting the app
|
||||
- Temporary fix to show error when user is creating an account on matrix.org with userId containing only digits (#1410)
|
||||
|
||||
Translations 🗣:
|
||||
-
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.os.Bundle
|
|||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.autofill.HintConstants
|
||||
import androidx.core.text.isDigitsOnly
|
||||
import androidx.core.view.isVisible
|
||||
import butterknife.OnClick
|
||||
import com.airbnb.mvrx.Fail
|
||||
|
@ -53,6 +54,9 @@ class LoginFragment @Inject constructor() : AbstractLoginFragment() {
|
|||
|
||||
private var passwordShown = false
|
||||
private var isSignupMode = false
|
||||
// Temporary patch for https://github.com/vector-im/riotX-android/issues/1410,
|
||||
// waiting for https://github.com/matrix-org/synapse/issues/7576
|
||||
private var isNumericOnlyUserIdForbidden = false
|
||||
|
||||
override fun getLayoutResId() = R.layout.fragment_login
|
||||
|
||||
|
@ -101,6 +105,10 @@ class LoginFragment @Inject constructor() : AbstractLoginFragment() {
|
|||
loginFieldTil.error = getString(if (isSignupMode) R.string.error_empty_field_choose_user_name else R.string.error_empty_field_enter_user_name)
|
||||
error++
|
||||
}
|
||||
if (isSignupMode && isNumericOnlyUserIdForbidden && login.isDigitsOnly()) {
|
||||
loginFieldTil.error = "The homeserver does not accept username with only digits."
|
||||
error++
|
||||
}
|
||||
if (password.isEmpty()) {
|
||||
passwordFieldTil.error = getString(if (isSignupMode) R.string.error_empty_field_choose_password else R.string.error_empty_field_your_password)
|
||||
error++
|
||||
|
@ -227,6 +235,7 @@ class LoginFragment @Inject constructor() : AbstractLoginFragment() {
|
|||
|
||||
override fun updateWithState(state: LoginViewState) {
|
||||
isSignupMode = state.signMode == SignMode.SignUp
|
||||
isNumericOnlyUserIdForbidden = state.serverType == ServerType.MatrixOrg
|
||||
|
||||
setupUi(state)
|
||||
setupAutoFill(state)
|
||||
|
|
Loading…
Reference in a new issue