about summary refs log tree commit diff
path: root/app/views/about
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-08-12 12:11:15 +0200
committerStarfall <us@starfall.systems>2020-08-25 13:36:48 -0500
commitd1cf10154133d63a770fe263d788908b04571513 (patch)
tree1d32f8ab0acadbde1b0ba6af5b7e6ffda4015116 /app/views/about
parentd8997f3caac3f2ab4785e019de07efc550271b74 (diff)
Add client-side validation in password change forms (#14564)
* Fix client-side username validation at registration

It used the Account::USERNAME_RE regexp which is for *remote* users,
local user validation is stricter. Also take into account max username length.

* Add client-side form validation for password change

* Add client-side form validation to dedicated registration form

Previous changes only applied to the /about page, not the dedicated form on
/auth
Diffstat (limited to 'app/views/about')
-rw-r--r--app/views/about/_registration.html.haml2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/views/about/_registration.html.haml b/app/views/about/_registration.html.haml
index f65e67427..336acad6a 100644
--- a/app/views/about/_registration.html.haml
+++ b/app/views/about/_registration.html.haml
@@ -4,7 +4,7 @@
 
     .fields-group
       = f.simple_fields_for :account do |account_fields|
-        = account_fields.input :username, wrapper: :with_label, label: false, required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.username'), :autocomplete => 'off', placeholder: t('simple_form.labels.defaults.username'), pattern: Account::USERNAME_RE.source }, append: "@#{site_hostname}", hint: false, disabled: closed_registrations?
+        = account_fields.input :username, wrapper: :with_label, label: false, required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.username'), :autocomplete => 'off', placeholder: t('simple_form.labels.defaults.username'), pattern: '[a-z0-9_]+', maxlength: 30 }, append: "@#{site_hostname}", hint: false, disabled: closed_registrations?
 
       = f.input :email, placeholder: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email'), :autocomplete => 'off' }, hint: false, disabled: closed_registrations?
       = f.input :password, placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password'), :autocomplete => 'off', :minlength => User.password_length.first, :maxlength => User.password_length.last }, hint: false, disabled: closed_registrations?