mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-20 13:38:34 +01:00
Merge pull request #2089 from vector-im/feature/dendrite_test
Show M_WEAK_PASSWORD error in the password field
This commit is contained in:
commit
6f1875c13a
@ -132,6 +132,8 @@ data class MatrixError(
|
||||
const val M_CANNOT_LEAVE_SERVER_NOTICE_ROOM = "M_CANNOT_LEAVE_SERVER_NOTICE_ROOM"
|
||||
/** (Not documented yet) */
|
||||
const val M_WRONG_ROOM_KEYS_VERSION = "M_WRONG_ROOM_KEYS_VERSION"
|
||||
/** (Not documented yet) */
|
||||
const val M_WEAK_PASSWORD = "M_WEAK_PASSWORD"
|
||||
|
||||
const val M_TERMS_NOT_SIGNED = "M_TERMS_NOT_SIGNED"
|
||||
|
||||
|
@ -33,13 +33,13 @@ import im.vector.app.core.extensions.exhaustive
|
||||
import im.vector.app.core.extensions.hideKeyboard
|
||||
import im.vector.app.core.extensions.showPassword
|
||||
import im.vector.app.core.extensions.toReducedUrl
|
||||
import org.matrix.android.sdk.api.failure.Failure
|
||||
import org.matrix.android.sdk.api.failure.MatrixError
|
||||
import org.matrix.android.sdk.api.failure.isInvalidPassword
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.functions.BiFunction
|
||||
import io.reactivex.rxkotlin.subscribeBy
|
||||
import kotlinx.android.synthetic.main.fragment_login.*
|
||||
import org.matrix.android.sdk.api.failure.Failure
|
||||
import org.matrix.android.sdk.api.failure.MatrixError
|
||||
import org.matrix.android.sdk.api.failure.isInvalidPassword
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
@ -234,7 +234,13 @@ class LoginFragment @Inject constructor() : AbstractLoginFragment() {
|
||||
}
|
||||
|
||||
override fun onError(throwable: Throwable) {
|
||||
loginFieldTil.error = errorFormatter.toHumanReadable(throwable)
|
||||
// Show M_WEAK_PASSWORD error in the password field
|
||||
if (throwable is Failure.ServerError
|
||||
&& throwable.error.code == MatrixError.M_WEAK_PASSWORD) {
|
||||
passwordFieldTil.error = errorFormatter.toHumanReadable(throwable)
|
||||
} else {
|
||||
loginFieldTil.error = errorFormatter.toHumanReadable(throwable)
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateWithState(state: LoginViewState) {
|
||||
|
Loading…
Reference in New Issue
Block a user