mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 08:11:52 +01:00
Login fixes.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d34b925136
commit
39e9a6d942
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
require_once('../wp-config.php');
|
||||
|
||||
if ( !empty($_COOKIE['wordpressuser_' . COOKIEHASH]) && !wp_login($_COOKIE['wordpressuser_' . COOKIEHASH], $_COOKIE['wordpresspass_' . COOKIEHASH]) ) {
|
||||
if ( !empty($_COOKIE['wordpressuser_' . COOKIEHASH]) && !wp_login($_COOKIE['wordpressuser_' . COOKIEHASH], $_COOKIE['wordpresspass_' . COOKIEHASH], true) ) {
|
||||
header('Expires: Wed, 5 Jun 1979 23:41:00 GMT'); // Michel's birthday
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-cache, must-revalidate');
|
||||
|
@ -1907,8 +1907,7 @@ function wp_login($username, $password, $already_md5 = false) {
|
||||
$error = __('<strong>Error</strong>: Wrong login.');
|
||||
return false;
|
||||
} else {
|
||||
|
||||
if ( ($login->user_login == $username && $login->user_pass == $password) || ($already_md5 && $login->user_login == $username && md5($login->user_pass) == $password) ) {
|
||||
if ( ($already_md5 && $login->user_login == $username && $login->user_pass == $password) || ($login->user_login == $username && $login->user_pass == md5($password)) ) {
|
||||
return true;
|
||||
} else {
|
||||
$error = __('<strong>Error</strong>: Incorrect password.');
|
||||
|
47
wp-login.php
47
wp-login.php
@ -142,8 +142,12 @@ default:
|
||||
|
||||
if( !empty($_POST) ) {
|
||||
$log = $_POST['log'];
|
||||
$pwd = md5($_POST['pwd']);
|
||||
$pwd = $_POST['pwd'];
|
||||
$redirect_to = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $_POST['redirect_to']);
|
||||
} else {
|
||||
$log = '';
|
||||
$pwd = '';
|
||||
$redirect_to = '';
|
||||
}
|
||||
|
||||
$user = get_userdatabylogin($log);
|
||||
@ -152,30 +156,31 @@ default:
|
||||
$redirect_to = get_settings('siteurl') . '/wp-admin/profile.php';
|
||||
}
|
||||
|
||||
if ( wp_login($log, $pwd) ) {
|
||||
$user_login = $log;
|
||||
$user_pass = $pwd;
|
||||
setcookie('wordpressuser_'. COOKIEHASH, $user_login, time() + 31536000, COOKIEPATH);
|
||||
setcookie('wordpresspass_'. COOKIEHASH, md5($user_pass), time() + 31536000, COOKIEPATH);
|
||||
|
||||
if ($is_IIS)
|
||||
header("Refresh: 0;url=$redirect_to");
|
||||
else
|
||||
header("Location: $redirect_to");
|
||||
}
|
||||
|
||||
if( !empty($_COOKIE['wordpressuser_' . COOKIEHASH]) && !empty($_COOKIE['wordpresspass_' . COOKIEHASH]) ) {
|
||||
if ($log && $pwd) {
|
||||
if ( wp_login($log, $pwd) ) {
|
||||
$user_login = $log;
|
||||
$user_pass = md5($pwd);
|
||||
setcookie('wordpressuser_'. COOKIEHASH, $user_login, time() + 31536000, COOKIEPATH);
|
||||
setcookie('wordpresspass_'. COOKIEHASH, $user_pass, time() + 31536000, COOKIEPATH);
|
||||
|
||||
if ($is_IIS)
|
||||
header("Refresh: 0;url=$redirect_to");
|
||||
else
|
||||
header("Location: $redirect_to");
|
||||
}
|
||||
} else if ( !empty($_COOKIE['wordpressuser_' . COOKIEHASH]) && !empty($_COOKIE['wordpresspass_' . COOKIEHASH]) ) {
|
||||
$user_login = $_COOKIE['wordpressuser_' . COOKIEHASH];
|
||||
$user_pass_md5 = $_COOKIE['wordpresspass_' . COOKIEHASH];
|
||||
|
||||
if ( wp_login($user_login, $user_pass_md5, true) ) {
|
||||
header('Location: wp-admin/');
|
||||
exit();
|
||||
} else {
|
||||
if ( !empty($_COOKIE['wordpressuser_' . COOKIEHASH]) )
|
||||
$error = 'Your session has expired.';
|
||||
}
|
||||
}
|
||||
|
||||
if ( wp_login($user_login, $user_pass_md5, true) ) {
|
||||
header('Location: wp-admin/');
|
||||
exit();
|
||||
} else {
|
||||
if ( !empty($_COOKIE['wordpressuser_' . COOKIEHASH]) )
|
||||
$error = 'Your session has expired.';
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
Loading…
Reference in New Issue
Block a user