Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
a7615135
Commit
a7615135
authored
Feb 15, 2003
by
Kjartan
Browse files
- Modifying user_validate_mail() to accept more e-mail addresses.
parent
a7a323e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/user.module
View file @
a7615135
...
...
@@ -187,7 +187,12 @@ function user_validate_mail($mail) {
** allowed.
*/
if
(
$mail
&&
!
eregi
(
"^[0-9a-z_\.-]+@(([0-9]
{
1,3}\.){3}[0-9]{1,3}|([0-9a-z][0-9a-z-]*[0-9a-z]\.)+[a-z]{2,
}
)$"
,
$mail
))
{
$user
=
'[a-zA-Z0-9_\-\.]+'
;
$domain
=
'(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]\.?)+'
;
$ipv4
=
'[0-9]{1,3}(\.[0-9]{1,3}){3}'
;
$ipv6
=
'[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7}'
;
if
(
$mail
&&
!
preg_match
(
"/^
$user
@(
$domain
|(\[(
$ipv4
|
$ipv6
)\]))$/"
,
$mail
))
{
return
t
(
"The e-mail address '%mail' is not valid."
,
array
(
"%mail"
=>
$mail
));
}
}
...
...
modules/user/user.module
View file @
a7615135
...
...
@@ -187,7 +187,12 @@ function user_validate_mail($mail) {
** allowed.
*/
if
(
$mail
&&
!
eregi
(
"^[0-9a-z_\.-]+@(([0-9]
{
1,3}\.){3}[0-9]{1,3}|([0-9a-z][0-9a-z-]*[0-9a-z]\.)+[a-z]{2,
}
)$"
,
$mail
))
{
$user
=
'[a-zA-Z0-9_\-\.]+'
;
$domain
=
'(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]\.?)+'
;
$ipv4
=
'[0-9]{1,3}(\.[0-9]{1,3}){3}'
;
$ipv6
=
'[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7}'
;
if
(
$mail
&&
!
preg_match
(
"/^
$user
@(
$domain
|(\[(
$ipv4
|
$ipv6
)\]))$/"
,
$mail
))
{
return
t
(
"The e-mail address '%mail' is not valid."
,
array
(
"%mail"
=>
$mail
));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment