Now that we have a fancier password complexity check, remove the older minimum
length to avoid the feeling of two password style guides fighting each other.
This adds a password complexity rule during registration to require strong
passwords. This is based on the `zxcvbn` module that we already use for key
backup passphrases.
In addition, this also tweaks validation more generally to allow rules to be
async functions.
In addition to migrating password fields, this also removes the remaining
support for old-style validation in registration now that all checks have been
converted.
When submitting a form, we want to validate more strictly to check for empty
values that might be required. A separate mode is used since we want to ignore
this issue when visiting a field one by one to enter data.
As an example, we convert the pre-existing logic for the username requirement
using this new support.
Since we're keeping the input as a ref anyway, let's use that rather than
requiring the value to be passed to `validate`. This allows others to call
`validate` as well.
This adjusts the submission step to focus the first invalid field and redisplay
validation. This also rearranges the older style field error handling on
registration which is slated for removal once we convert all fields to the new
style.
This updates the registration form to include the new-style validation state
when deciding whether the entire form is valid overall.
In addition, this tweaks the validation helper to take functions instead of
strings for translated text. This allows the validation helper to be create once
per component instead of once every render, which improves performance.
Should be enough to make copy-pasting not a nightmare.
For vector-im/riot-web#7460
Also remove an instance where the vendor prefixes were used, but a build
step adds those automatically
Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
The Forgot Password screen wasn't checking the default server name for a value
before showing it, leading to a possible "Your Matrix account on <blank>"
message.
Fixes https://github.com/vector-im/riot-web/issues/9507
Alt-enter is a common macOS shortcut for inserting a new line in an
input that has a separate action tied to the enter key.
Signed-off-by: Ross Brandes <ross.brandes@gmail.com>