Option to force SSL. see #7561

git-svn-id: https://develop.svn.wordpress.org/trunk@8701 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-08-21 17:40:38 +00:00
parent 13e463fd0e
commit c7cd726bf1
5 changed files with 63 additions and 15 deletions
+13 -1
View File
@@ -703,8 +703,20 @@ function auth_redirect() {
}
}
if ( wp_validate_auth_cookie() )
if ( $user_id = wp_validate_auth_cookie() ) {
// If the user wants ssl but the session is not ssl, redirect.
if ( !$secure && get_user_option('use_ssl', $user_id) ) {
if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
exit();
} else {
wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit();
}
}
return; // The cookie is good so we're done
}
// The cookie is no good so force login
nocache_headers();