Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
22479d87
Commit
22479d87
authored
Jul 31, 2005
by
Steven Wittens
Browse files
Options
Downloads
Patches
Plain Diff
- Add some Unicode checks to username validation
parent
61999af9
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/user.module
+11
-0
11 additions, 0 deletions
modules/user.module
modules/user/user.module
+11
-0
11 additions, 0 deletions
modules/user/user.module
with
22 additions
and
0 deletions
modules/user.module
+
11
−
0
View file @
22479d87
...
@@ -214,6 +214,17 @@ function user_validate_name($name) {
...
@@ -214,6 +214,17 @@ function user_validate_name($name) {
if
(
substr
(
$name
,
-
1
)
==
' '
)
return
t
(
'The username cannot end with a space.'
);
if
(
substr
(
$name
,
-
1
)
==
' '
)
return
t
(
'The username cannot end with a space.'
);
if
(
ereg
(
' '
,
$name
))
return
t
(
'The username cannot contain multiple spaces in a row.'
);
if
(
ereg
(
' '
,
$name
))
return
t
(
'The username cannot contain multiple spaces in a row.'
);
if
(
ereg
(
"[^
\x80
-
\xF7
[:alnum:]@_.-]"
,
$name
))
return
t
(
'The username contains an illegal character.'
);
if
(
ereg
(
"[^
\x80
-
\xF7
[:alnum:]@_.-]"
,
$name
))
return
t
(
'The username contains an illegal character.'
);
if
(
preg_match
(
'/[\x{80}-\x{A0}'
.
// Non-printable ISO-8859-1 + NBSP
'\x{AD}'
.
// Soft-hyphen
'\x{2000}-\x{200F}'
.
// Various space characters
'\x{2028}-\x{202F}'
.
// Bidirectional text overrides
'\x{205F}-\x{206F}'
.
// Various text hinting characters
'\x{FEFF}'
.
// Byte order mark
'\x{FF01}-\x{FF60}'
.
// Full-width latin
'\x{FFF9}-\x{FFFD}]/u'
,
// Replacement characters
$name
))
{
return
t
(
'The username contains an illegal character.'
);
}
if
(
ereg
(
'@'
,
$name
)
&&
!
eregi
(
'@([0-9a-z](-?[0-9a-z])*.)+[a-z]{2}([zmuvtg]|fo|me)?$'
,
$name
))
return
t
(
'The username is not a valid authentication ID.'
);
if
(
ereg
(
'@'
,
$name
)
&&
!
eregi
(
'@([0-9a-z](-?[0-9a-z])*.)+[a-z]{2}([zmuvtg]|fo|me)?$'
,
$name
))
return
t
(
'The username is not a valid authentication ID.'
);
if
(
strlen
(
$name
)
>
56
)
return
t
(
'The username %name is too long: it must be less than 56 characters.'
,
array
(
'%name'
=>
theme
(
'placeholder'
,
$name
)));
if
(
strlen
(
$name
)
>
56
)
return
t
(
'The username %name is too long: it must be less than 56 characters.'
,
array
(
'%name'
=>
theme
(
'placeholder'
,
$name
)));
}
}
...
...
This diff is collapsed.
Click to expand it.
modules/user/user.module
+
11
−
0
View file @
22479d87
...
@@ -214,6 +214,17 @@ function user_validate_name($name) {
...
@@ -214,6 +214,17 @@ function user_validate_name($name) {
if
(
substr
(
$name
,
-
1
)
==
' '
)
return
t
(
'The username cannot end with a space.'
);
if
(
substr
(
$name
,
-
1
)
==
' '
)
return
t
(
'The username cannot end with a space.'
);
if
(
ereg
(
' '
,
$name
))
return
t
(
'The username cannot contain multiple spaces in a row.'
);
if
(
ereg
(
' '
,
$name
))
return
t
(
'The username cannot contain multiple spaces in a row.'
);
if
(
ereg
(
"[^
\x80
-
\xF7
[:alnum:]@_.-]"
,
$name
))
return
t
(
'The username contains an illegal character.'
);
if
(
ereg
(
"[^
\x80
-
\xF7
[:alnum:]@_.-]"
,
$name
))
return
t
(
'The username contains an illegal character.'
);
if
(
preg_match
(
'/[\x{80}-\x{A0}'
.
// Non-printable ISO-8859-1 + NBSP
'\x{AD}'
.
// Soft-hyphen
'\x{2000}-\x{200F}'
.
// Various space characters
'\x{2028}-\x{202F}'
.
// Bidirectional text overrides
'\x{205F}-\x{206F}'
.
// Various text hinting characters
'\x{FEFF}'
.
// Byte order mark
'\x{FF01}-\x{FF60}'
.
// Full-width latin
'\x{FFF9}-\x{FFFD}]/u'
,
// Replacement characters
$name
))
{
return
t
(
'The username contains an illegal character.'
);
}
if
(
ereg
(
'@'
,
$name
)
&&
!
eregi
(
'@([0-9a-z](-?[0-9a-z])*.)+[a-z]{2}([zmuvtg]|fo|me)?$'
,
$name
))
return
t
(
'The username is not a valid authentication ID.'
);
if
(
ereg
(
'@'
,
$name
)
&&
!
eregi
(
'@([0-9a-z](-?[0-9a-z])*.)+[a-z]{2}([zmuvtg]|fo|me)?$'
,
$name
))
return
t
(
'The username is not a valid authentication ID.'
);
if
(
strlen
(
$name
)
>
56
)
return
t
(
'The username %name is too long: it must be less than 56 characters.'
,
array
(
'%name'
=>
theme
(
'placeholder'
,
$name
)));
if
(
strlen
(
$name
)
>
56
)
return
t
(
'The username %name is too long: it must be less than 56 characters.'
,
array
(
'%name'
=>
theme
(
'placeholder'
,
$name
)));
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment