- Patch #11791 by kps: trim passwords to avoid copy-paste mistakes.

4.7.x
Dries Buytaert 2005-05-21 11:57:59 +00:00
parent fafa11aff0
commit 2a744f8950
2 changed files with 6 additions and 2 deletions

View File

@ -805,7 +805,7 @@ function user_login($edit = array(), $msg = '') {
else if ($edit['name'] && $edit['pass']) { else if ($edit['name'] && $edit['pass']) {
if (!$user->uid) { if (!$user->uid) {
$user = user_authenticate($edit['name'], $edit['pass']); $user = user_authenticate($edit['name'], trim($edit['pass']));
} }
if ($user->uid) { if ($user->uid) {
@ -1158,6 +1158,8 @@ function user_edit_validate($uid, &$edit) {
// If required, check that proposed passwords match. If so, add the new password to $edit. // If required, check that proposed passwords match. If so, add the new password to $edit.
if ($edit['pass1']) { if ($edit['pass1']) {
$edit['pass1'] = trim($edit['pass1']);
$edit['pass2'] = trim($edit['pass2']);
if ($edit['pass1'] == $edit['pass2']) { if ($edit['pass1'] == $edit['pass2']) {
$edit['pass'] = $edit['pass1']; $edit['pass'] = $edit['pass1'];
} }

View File

@ -805,7 +805,7 @@ function user_login($edit = array(), $msg = '') {
else if ($edit['name'] && $edit['pass']) { else if ($edit['name'] && $edit['pass']) {
if (!$user->uid) { if (!$user->uid) {
$user = user_authenticate($edit['name'], $edit['pass']); $user = user_authenticate($edit['name'], trim($edit['pass']));
} }
if ($user->uid) { if ($user->uid) {
@ -1158,6 +1158,8 @@ function user_edit_validate($uid, &$edit) {
// If required, check that proposed passwords match. If so, add the new password to $edit. // If required, check that proposed passwords match. If so, add the new password to $edit.
if ($edit['pass1']) { if ($edit['pass1']) {
$edit['pass1'] = trim($edit['pass1']);
$edit['pass2'] = trim($edit['pass2']);
if ($edit['pass1'] == $edit['pass2']) { if ($edit['pass1'] == $edit['pass2']) {
$edit['pass'] = $edit['pass1']; $edit['pass'] = $edit['pass1'];
} }