mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Merge pull request #1415 from vector-im/feature/signup_username_digit
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:
commit
40f2d19f81
@ -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 🗣:
|
||||
-
|
||||
|
@ -49,7 +49,7 @@ internal class DefaultSignOutTask @Inject constructor(
|
||||
apiCall = signOutAPI.signOut()
|
||||
}
|
||||
} catch (throwable: Throwable) {
|
||||
// Maybe due to https://github.com/matrix-org/synapse/issues/5755
|
||||
// Maybe due to https://github.com/matrix-org/synapse/issues/5756
|
||||
if (throwable is Failure.ServerError
|
||||
&& throwable.httpCode == HttpURLConnection.HTTP_UNAUTHORIZED /* 401 */
|
||||
&& throwable.error.code == MatrixError.M_UNKNOWN_TOKEN) {
|
||||
|
@ -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 New Issue
Block a user