Skip to content

Commit

Permalink
Using /register/available also fixes #1410
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarty committed Apr 29, 2021
1 parent c09f7e0 commit b3ac1a1
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 27 deletions.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Features ✨:

Improvements 🙌:
- Add ability to install APK from directly from Element (#2381)
- Improve login/register flow (#2585, #3172)
- Improve login/register flow (#1410, #2585, #3172)

Bugfix 🐛:
- Message states cosmetic changes (#3007)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ import javax.inject.Inject
*/
class LoginFragmentSignupUsername2 @Inject constructor() : AbstractSSOLoginFragment2<FragmentLoginSignupUsername2Binding>() {

// 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 getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentLoginSignupUsername2Binding {
return FragmentLoginSignupUsername2Binding.inflate(inflater, container, false)
}
Expand Down Expand Up @@ -79,10 +75,6 @@ class LoginFragmentSignupUsername2 @Inject constructor() : AbstractSSOLoginFragm
views.loginFieldTil.error = getString(R.string.error_empty_field_choose_user_name)
error++
}
if (isNumericOnlyUserIdForbidden && login.isDigitsOnly()) {
views.loginFieldTil.error = "The homeserver does not accept username with only digits."
error++
}

if (error == 0) {
loginViewModel.handle(LoginAction2.SetUserName(login))
Expand Down Expand Up @@ -138,8 +130,6 @@ class LoginFragmentSignupUsername2 @Inject constructor() : AbstractSSOLoginFragm

@SuppressLint("SetTextI18n")
override fun updateWithState(state: LoginViewState2) {
isNumericOnlyUserIdForbidden = state.isNumericOnlyUserIdForbidden

setupUi(state)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ class LoginFragmentToAny2 @Inject constructor() : AbstractSSOLoginFragment2<Frag

private var passwordShown = 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 getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentLoginSigninToAny2Binding {
return FragmentLoginSigninToAny2Binding.inflate(inflater, container, false)
}
Expand Down Expand Up @@ -104,10 +100,6 @@ class LoginFragmentToAny2 @Inject constructor() : AbstractSSOLoginFragment2<Frag
views.loginFieldTil.error = getString(R.string.error_empty_field_enter_user_name)
error++
}
if (isNumericOnlyUserIdForbidden && login.isDigitsOnly()) {
views.loginFieldTil.error = "The homeserver does not accept username with only digits."
error++
}
if (password.isEmpty()) {
views.passwordFieldTil.error = getString(R.string.error_empty_field_your_password)
error++
Expand Down Expand Up @@ -213,8 +205,6 @@ class LoginFragmentToAny2 @Inject constructor() : AbstractSSOLoginFragment2<Frag
}

override fun updateWithState(state: LoginViewState2) {
isNumericOnlyUserIdForbidden = state.isNumericOnlyUserIdForbidden

setupUi(state)

if (state.isLoading) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ class LoginViewModel2 @AssistedInject constructor(
loginMode = LoginMode.Sso(action.ssoIdentityProviders),
homeServerUrlFromUser = action.homeServerUrl,
homeServerUrl = action.homeServerUrl,
isNumericOnlyUserIdForbidden = action.homeServerUrl == matrixOrgUrl,
deviceId = action.deviceId
)
}
Expand Down Expand Up @@ -662,7 +661,6 @@ class LoginViewModel2 @AssistedInject constructor(
isLoading = false,
homeServerUrlFromUser = urlFromUser,
homeServerUrl = data.homeServerUrl,
isNumericOnlyUserIdForbidden = urlFromUser == matrixOrgUrl,
loginMode = loginMode
)
}
Expand Down Expand Up @@ -818,7 +816,6 @@ class LoginViewModel2 @AssistedInject constructor(
isLoading = false,
homeServerUrlFromUser = homeServerConnectionConfig.homeServerUri.toString(),
homeServerUrl = data.homeServerUrl,
isNumericOnlyUserIdForbidden = homeServerConnectionConfig.homeServerUri.toString() == matrixOrgUrl,
loginMode = loginMode
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ data class LoginViewState2(
// Network result
val loginProfileInfo: Async<LoginProfileInfo> = Uninitialized,

// True on Matrix.org
val isNumericOnlyUserIdForbidden: Boolean = false,

// Network result
@PersistState
val loginMode: LoginMode = LoginMode.Unknown,
Expand Down

0 comments on commit b3ac1a1

Please sign in to comment.