mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-30 19:04:54 +01:00
Merge pull request #1103 from vector-im/feature/space_in_passwords
Detect spaces in password if user fails to login (#1038)
This commit is contained in:
commit
dcb618c257
@ -6,6 +6,7 @@ Features ✨:
|
||||
|
||||
Improvements 🙌:
|
||||
- Add support for `/plain` command (#12)
|
||||
- Detect spaces in password if user fail to login (#1038)
|
||||
- FTUE: do not display a different color when encrypting message when not in developer mode.
|
||||
|
||||
Bugfix 🐛:
|
||||
|
@ -209,7 +209,14 @@ class LoginFragment @Inject constructor() : AbstractLoginFragment() {
|
||||
} else {
|
||||
// Trick to display the error without text.
|
||||
loginFieldTil.error = " "
|
||||
passwordFieldTil.error = errorFormatter.toHumanReadable(state.asyncLoginAction.error)
|
||||
if (error is Failure.ServerError
|
||||
&& error.error.code == MatrixError.M_FORBIDDEN
|
||||
&& error.error.message == "Invalid password"
|
||||
&& spaceInPassword()) {
|
||||
passwordFieldTil.error = getString(R.string.auth_invalid_login_param_space_in_password)
|
||||
} else {
|
||||
passwordFieldTil.error = errorFormatter.toHumanReadable(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Success is handled by the LoginActivity
|
||||
@ -226,4 +233,9 @@ class LoginFragment @Inject constructor() : AbstractLoginFragment() {
|
||||
is Success -> Unit
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect if password ends or starts with spaces
|
||||
*/
|
||||
private fun spaceInPassword() = passwordField.text.toString().let { it.trim() != it }
|
||||
}
|
||||
|
@ -29,4 +29,5 @@
|
||||
<string name="command_description_plain">Sends a message as plain text, without interpreting it as markdown</string>
|
||||
<!-- END Strings added by Others -->
|
||||
|
||||
<string name="auth_invalid_login_param_space_in_password">Incorrect username and/or password. The entered password starts or ends with spaces, please check it.</string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user