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
eef5c498
Commit
eef5c498
authored
Sep 05, 2006
by
Dries
Browse files
- Patch
#82435
by chx: usability: reworked the 'request new password' form.
parent
9c7eecaa
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/user/user.module
View file @
eef5c498
...
...
@@ -905,7 +905,7 @@ function user_login_validate($form_id, $form_values) {
$user
=
user_authenticate
(
$form_values
[
'name'
],
trim
(
$form_values
[
'pass'
]));
if
(
!
$user
->
uid
)
{
form_set_error
(
'login'
,
t
(
'Sorry
. U
nrecognized username or password.'
)
.
' '
.
l
(
t
(
'Have you forgotten your password?'
),
'user/password'
));
form_set_error
(
'login'
,
t
(
'Sorry
, u
nrecognized username or password.'
)
.
' '
.
l
(
t
(
'Have you forgotten your password?'
),
'user/password'
));
watchdog
(
'user'
,
t
(
'Login attempt failed for %user.'
,
array
(
'%user'
=>
$form_values
[
'name'
])));
}
}
...
...
@@ -1004,14 +1004,10 @@ function user_pass() {
// Display form:
$form
[
'name'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Username'
),
'#title'
=>
t
(
'Username
or e-mail address
'
),
'#size'
=>
30
,
'#maxlength'
=>
60
,
);
$form
[
'mail'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'E-mail address'
),
'#size'
=>
30
,
'#maxlength'
=>
64
,
'#required'
=>
TRUE
,
);
$form
[
'submit'
]
=
array
(
'#type'
=>
'submit'
,
'#value'
=>
t
(
'E-mail new password'
),
...
...
@@ -1020,19 +1016,17 @@ function user_pass() {
return
$form
;
}
function
user_pass_validate
()
{
global
$form_values
;
function
user_pass_validate
(
$form_id
,
$form_values
)
{
$name
=
$form_values
[
'name'
];
$mail
=
$
form_values
[
'mail'
]
;
if
(
$name
&&
!
(
$form_values
[
'account'
]
=
user_load
(
array
(
'name'
=>
$name
,
'status'
=>
1
)))
)
{
form_set_error
(
'name'
,
t
(
'Sorry. The username %name is not recognized.'
,
array
(
'
%
name'
=>
$name
)
));
$
account
=
user_load
(
array
(
'
mail
'
=
>
$
name
,
'status'
=>
1
))
;
if
(
!
$account
)
{
$account
=
user_load
(
array
(
'name'
=>
$name
,
'status'
=>
1
));
}
else
if
(
$mail
&&
!
(
$form_values
[
'account'
]
=
user_load
(
array
(
'mail'
=>
$mail
,
'status'
=>
1
)))
)
{
form_set_
error
(
'mail'
,
t
(
'Sorry. The e-mail address %email is not recognized.'
,
array
(
'%email'
=>
$mail
))
);
if
(
$account
->
uid
)
{
form_set_
value
(
array
(
'#parents'
=>
array
(
'account'
)),
$account
);
}
else
if
(
!
$mail
&&
!
$name
)
{
form_set_error
(
'
password'
,
t
(
'You must provide either
a username or e
-
mail address.'
));
else
{
form_set_error
(
'
name'
,
t
(
'Sorry, %name is not recognized as
a user
name or
an
email address.'
,
array
(
'%name'
=>
$name
)
));
}
}
...
...
@@ -1059,12 +1053,6 @@ function user_pass_submit($form_id, $form_values) {
return
'user'
;
}
function
theme_user_pass
(
$form
)
{
$output
=
'<p>'
.
t
(
'Enter your username <strong><em>or</em></strong> your e-mail address.'
)
.
'</p>'
;
$output
.
=
drupal_render
(
$form
);
return
$output
;
}
/**
* Menu callback; process one time login link and redirects to the user page on success.
*/
...
...
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