--- wp-login.php.orig	2008-04-08 17:29:40.000000000 -0700
+++ wp-login.php	2008-05-01 13:33:08.000000000 -0700
@@ -1,34 +1,20 @@
 <?php
 require( dirname(__FILE__) . '/wp-config.php' );
 
+/* support for custom error page by user kevinobvious -- http://wordpress.org/support/topic/109477 */
+if (function_exists('get_template_directory')){
+	$templatedir = get_template_directory();
+	if ( file_exists($templatedir.'/login.php') ){
+		include($templatedir.'/login.php');
+	}
+}
 // Rather than duplicating this HTML all over the place, we'll stick it in function
-function login_header($title = 'Login', $message = '', $wp_error = '') {
+function login_header_error($message = '', $wp_error = '') {
 	global $error;
 
 	if ( empty($wp_error) )
 		$wp_error = new WP_Error();
-	?>
-<!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" <?php language_attributes(); ?>>
-<head>
-	<title><?php bloginfo('name'); ?> &rsaquo; <?php echo $title; ?></title>
-	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
-	<?php
-	wp_admin_css( 'css/login' );
-	wp_admin_css( 'css/colors-fresh' );
-	?>
-	<script type="text/javascript">
-		function focusit() {
-			document.getElementById('user_login').focus();
-		}
-		window.onload = focusit;
-	</script>
-<?php do_action('login_head'); ?>
-</head>
-<body class="login">
 
-<div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?>" title="<?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?>"><?php bloginfo('name'); ?></a></h1>
-<?php
 	if ( !empty( $message ) ) echo apply_filters('login_message', $message) . "\n";
 
 	// Incase a plugin uses $error rather than the $errors object
@@ -54,7 +40,41 @@
 		if ( !empty($messages) )
 			echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
 	}
+}
+
+if (!function_exists('login_header')) {
+function login_header($title = 'Login', $message = '', $wp_error = '') {
+
+	?>
+<!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" <?php language_attributes(); ?>>
+<head>
+	<title><?php bloginfo('name'); ?> &rsaquo; <?php echo $title; ?></title>
+	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
+	<?php
+	wp_admin_css( 'css/login' );
+	wp_admin_css( 'css/colors-fresh' );
+	?>
+	<script type="text/javascript">
+		function focusit() {
+			document.getElementById('user_login').focus();
+		}
+		window.onload = focusit;
+	</script>
+<?php do_action('login_head'); ?>
+</head>
+<body class="login">
+
+<div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?>" title="<?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?>"><?php bloginfo('name'); ?></a></h1>
+<?php
+	login_header_error($message, $wp_error);
 } // End of login_header()
+}
+if (!function_exists('login_footer')) {
+	function login_footer() {
+		echo "\n</body>\n</html>";
+	}
+} // End of login_footer()
 
 function retrieve_password() {
 	global $wpdb;
@@ -269,9 +289,8 @@
 
 <p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
 
-</body>
-</html>
 <?php
+login_footer();
 break;
 
 case 'resetpass' :
@@ -333,10 +352,8 @@
 </div>
 
 <p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
-
-</body>
-</html>
 <?php
+login_footer();
 break;
 
 case 'login' :
@@ -410,11 +427,8 @@
 </div>
 
 <p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
-
-</body>
-</html>
 <?php
-
+login_footer();
 break;
 } // end action switch
 ?>

