Updated registration page username to disallow unallowed characters
• Updated: - registration page username to disallow unallowed characters (special characters, spaces, etc.) and rewrite if is written in that field
This commit is contained in:
parent
8a2f34d815
commit
538bcf21c9
|
@ -232,6 +232,19 @@ function main ( ) {
|
|||
|
||||
input.readonly = oldReadOnly;
|
||||
});
|
||||
|
||||
const handleRemoveSpecialCharactersForUsername = (e) => {
|
||||
var input = e.target;
|
||||
var text = input.value.replace(/[^\w\d_]/gmi, "");
|
||||
if (/\s/.test(text)) {
|
||||
text = text.replace(/\s/g, "");
|
||||
}
|
||||
input.value = text;
|
||||
};
|
||||
|
||||
delegate(document, '#user_account_attributes_username.registration_username', 'keydown', handleRemoveSpecialCharactersForUsername);
|
||||
delegate(document, '#user_account_attributes_username.registration_username', 'keyup', handleRemoveSpecialCharactersForUsername);
|
||||
delegate(document, '#user_account_attributes_username.registration_username', 'change', handleRemoveSpecialCharactersForUsername);
|
||||
}
|
||||
|
||||
loadPolyfills().then(main).catch(error => {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
= f.simple_fields_for :account do |ff|
|
||||
.fields-group
|
||||
= ff.input :username, wrapper: :with_label, autofocus: true, label: t('simple_form.labels.defaults.username'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.username'), :autocomplete => 'off' }, hint: t('simple_form.hints.defaults.username')
|
||||
= ff.input :username, wrapper: :with_label, autofocus: true, label: t('simple_form.labels.defaults.username'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.username'), :autocomplete => 'off', :class => "registration_username" }, hint: t('simple_form.hints.defaults.username')
|
||||
|
||||
.fields-group
|
||||
= f.input :email, wrapper: :with_label, label: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email'), :autocomplete => 'off' }
|
||||
|
|
|
@ -35,7 +35,7 @@ en:
|
|||
setting_noindex: Affects your public profile and status pages
|
||||
setting_show_application: The application you use to gab will be displayed in the detailed view of your gabs
|
||||
setting_theme: Affects how Gab Social looks when you're logged in from any device.
|
||||
username: Only numbers, letters, periods and underscores allowed. No spaces.
|
||||
username: Only numbers, letters and underscores allowed. No spaces.
|
||||
whole_word: When the keyword or phrase is alphanumeric only, it will only be applied if it matches the whole word
|
||||
featured_tag:
|
||||
name: 'You might want to use one of these:'
|
||||
|
|
|
@ -35,7 +35,7 @@ en_GB:
|
|||
setting_noindex: Affects your public profile and status pages
|
||||
setting_show_application: The application you use to gab will be displayed in the detailed view of your gabs
|
||||
setting_theme: Affects how Gab Social looks when you're logged in from any device.
|
||||
username: Only numbers, letters, periods and underscores allowed. No spaces.
|
||||
username: Only numbers, letters and underscores allowed. No spaces.
|
||||
whole_word: When the keyword or phrase is alphanumeric only, it will only be applied if it matches the whole word
|
||||
featured_tag:
|
||||
name: 'You might want to use one of these:'
|
||||
|
|
Loading…
Reference in New Issue