mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-17 04:20:00 +03:00
taking into account non ascii characters as invalid username error
This commit is contained in:
parent
bfd9dcbca2
commit
825ba77bb2
1 changed files with 4 additions and 1 deletions
|
@ -62,7 +62,10 @@ fun Throwable.isUsernameInUse() = this is Failure.ServerError &&
|
|||
error.code == MatrixError.M_USER_IN_USE
|
||||
|
||||
fun Throwable.isInvalidUsername() = this is Failure.ServerError &&
|
||||
error.code == MatrixError.M_INVALID_USERNAME
|
||||
(error.code == MatrixError.M_INVALID_USERNAME || usernameContainsNonAsciiCharacters())
|
||||
|
||||
private fun Failure.ServerError.usernameContainsNonAsciiCharacters() = error.code == MatrixError.M_UNKNOWN &&
|
||||
error.message == "Query parameter \'username\' must be ascii"
|
||||
|
||||
fun Throwable.isInvalidPassword() = this is Failure.ServerError &&
|
||||
error.code == MatrixError.M_FORBIDDEN &&
|
||||
|
|
Loading…
Add table
Reference in a new issue