Changeset 4339
- Timestamp:
- 10/04/2006 04:47:50 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/wp-admin.css
r4336 r4339 594 594 #login { 595 595 position: relative; 596 background: url('images/login-bkg-tile.gif') no-repeat top center #fbfbfb;596 background: url('images/login-bkg-tile.gif') no-repeat top center; 597 597 color: #fff; 598 /* height: 430px; */599 598 margin: 5em auto; 600 padding: 45px 50px 0;599 padding: 20px 50px 0; 601 600 width: 325px; 602 601 } … … 612 611 } 613 612 613 #login #login_error a { 614 color: #ebcd4e; 615 border-color: #ebcd4e; 616 } 617 614 618 #login #send { 615 619 color: #fff; … … 619 623 } 620 624 621 #login h1 {625 #login h1 a { 622 626 margin: 0 auto; 623 padding-bottom: 10px; 624 left: 137px; 625 height: 75px; 626 width: 75px; 627 } 628 629 #login h1 a { 627 height: 88px; 628 width: 320px; 630 629 display: block; 631 text-indent: -9999px;632 630 border-bottom: none; 631 } 632 633 #login .hide { 634 display: none; 635 } 636 637 #login .message { 638 font-size: 10pt; 639 text-align: center; 640 } 641 642 #login .register { 643 font-size: 20px; 633 644 } 634 645 … … 641 652 list-style: none; 642 653 margin: 0 -50px; 643 padding: 0 50px 5px;654 padding: 10px 50px 25px;; 644 655 } 645 656 646 657 #login ul:after { 647 648 649 650 651 658 content: "."; 659 display: block; 660 height: 0; 661 clear: both; 662 visibility: hidden; 652 663 } 653 664 654 665 #login ul li { 655 666 float: left; 656 font-size: 1 1px;657 padding: 15px 0;667 font-size: 12px; 668 padding: 5px 0; 658 669 text-align: center; 659 670 } … … 674 685 } 675 686 676 #login #log, #pwd, #user_login, #email{687 #login .input { 677 688 font-size: 1.8em; 678 689 margin-top: 3px; … … 686 697 #login #submit { 687 698 margin: 0; 688 font-size: 1.2em; 699 font-size: 15px; 700 } 701 702 #login .fullwidth { 703 width: 320px; 689 704 } 690 705 -
trunk/wp-includes/general-template.php
r4277 r4339 41 41 if ( ! is_user_logged_in() ) { 42 42 if ( get_option('users_can_register') ) 43 $link = $before . '<a href="' . get_option('siteurl') . '/wp- register.php">' . __('Register') . '</a>' . $after;43 $link = $before . '<a href="' . get_option('siteurl') . '/wp-login.php?action=register">' . __('Register') . '</a>' . $after; 44 44 else 45 45 $link = ''; -
trunk/wp-includes/pluggable.php
r4288 r4339 179 179 180 180 if ( '' == $password ) { 181 $error = __('<strong>E rror</strong>: The password field is empty.');181 $error = __('<strong>ERROR</strong>: The password field is empty.'); 182 182 return false; 183 183 } … … 187 187 188 188 if (!$login) { 189 $error = __('<strong>E rror</strong>: Wrongusername.');189 $error = __('<strong>ERROR</strong>: Invalid username.'); 190 190 return false; 191 191 } else { … … 195 195 return true; 196 196 } else { 197 $error = __('<strong>E rror</strong>: Incorrect password.');197 $error = __('<strong>ERROR</strong>: Incorrect password.'); 198 198 $pwd = ''; 199 199 return false; -
trunk/wp-login.php
r4186 r4339 3 3 4 4 $action = $_REQUEST['action']; 5 $error = '';5 $errors = array(); 6 6 7 7 if ( isset($_GET['key']) ) … … 21 21 } 22 22 23 switch($action) { 24 25 case 'logout': 26 27 wp_clearcookie(); 28 do_action('wp_logout'); 29 nocache_headers(); 30 31 $redirect_to = 'wp-login.php'; 32 if ( isset($_REQUEST['redirect_to']) ) 33 $redirect_to = $_REQUEST['redirect_to']; 34 35 wp_redirect($redirect_to); 36 exit(); 37 38 break; 39 40 case 'lostpassword': 41 do_action('lost_password'); 42 ?> 23 24 // Rather than duplicating this HTML all over the place, we'll stick it in function 25 function login_header($title = 'Login', $message = '') { 26 global $errors, $error; 27 28 ?> 43 29 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 44 30 <html xmlns="http://www.w3.org/1999/xhtml"> 45 31 <head> 46 <title> WordPress » <?php _e('Lost Password')?></title>32 <title><?php bloginfo('name'); ?> › <?php echo $title; ?></title> 47 33 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> 48 <link rel="stylesheet" href="<?php echo get_option('siteurl'); ?>/wp-admin/wp-admin.css" type="text/css" /> 34 <link rel="stylesheet" href="<?php bloginfo('wpurl'); ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" /> 35 <!--[if IE]><style type="text/css">#login h1 a { margin-top: 35px; } #login ul { padding-bottom: 65px; }</style><![endif]--><!-- Curse you, IE! --> 49 36 <script type="text/javascript"> 50 function focusit() { 51 // focus on first input field 52 document.getElementById('user_login').focus(); 53 } 54 window.onload = focusit; 37 function focusit() { 38 document.getElementById('user_login').focus(); 39 } 40 window.onload = focusit; 55 41 </script> 56 <style type="text/css"> 57 #user_login, #email, #submit { 58 font-size: 1.7em; 59 } 60 </style> 42 <?php do_action('login_head'); ?> 61 43 </head> 62 44 <body> 45 63 46 <div id="login"> 64 <h1><a href="http://wordpress.org/">WordPress</a></h1> 65 <p><?php _e('Please enter your information here. We will send you a new password.') ?></p> 66 <?php 67 if ($error) 68 echo "<div id='login_error'>$error</div>"; 47 <h1><a href="<?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?>" title="<?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?>"><span class="hide"><?php bloginfo('name'); ?></span></a></h1> 48 <?php 49 if ( !empty( $message ) ) echo apply_filters('login_message', $message) . "\n"; 50 51 // Incase a plugin uses $error rather than the $errors array 52 if ( !empty( $error ) ) { 53 $errors['error'] = $error; 54 unset($error); 55 } 56 57 if ( !empty( $errors ) ) { 58 if ( is_array( $errors ) ) { 59 $newerrors = "\n"; 60 foreach ( $errors as $error ) $newerrors .= ' ' . $error . "<br />\n"; 61 $errors = $newerrors; 62 } 63 64 echo '<div id="login_error">' . apply_filters('login_errors', $errors) . "</div>\n"; 65 } 66 } // End of login_header() 67 68 69 switch ($action) { 70 71 case 'logout' : 72 73 wp_clearcookie(); 74 do_action('wp_logout'); 75 76 $redirect_to = 'wp-login.php?loggedout=true'; 77 if ( isset( $_REQUEST['redirect_to'] ) ) 78 $redirect_to = $_REQUEST['redirect_to']; 79 80 wp_redirect($redirect_to); 81 exit(); 82 83 break; 84 85 case 'lostpassword' : 86 case 'retrievepassword' : 87 $user_login = ''; 88 $user_pass = ''; 89 90 if ( $_POST ) { 91 if ( empty( $_POST['user_login'] ) ) 92 $errors['user_login'] = __('<strong>ERROR</strong>: The username field is empty.'); 93 if ( empty( $_POST['user_email'] ) ) 94 $errors['user_email'] = __('<strong>ERROR</strong>: The e-mail field is empty.'); 95 96 do_action('lostpassword_post'); 97 98 if ( empty( $errors ) ) { 99 $user_data = get_userdatabylogin(trim($_POST['user_login'])); 100 // redefining user_login ensures we return the right case in the email 101 $user_login = $user_data->user_login; 102 $user_email = $user_data->user_email; 103 104 if (!$user_email || $user_email != $_POST['user_email']) { 105 $errors['invalidcombo'] = __('<strong>ERROR</strong>: Invalid username / e-mail combination.'); 106 } else { 107 do_action('retreive_password', $user_login); // Misspelled and deprecated 108 do_action('retrieve_password', $user_login); 109 110 // Generate something random for a password... md5'ing current time with a rand salt 111 $key = substr( md5( uniqid( microtime() ) ), 0, 8); 112 // Now insert the new pass md5'd into the db 113 $wpdb->query("UPDATE $wpdb->users SET user_activation_key = '$key' WHERE user_login = '$user_login'"); 114 $message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n"; 115 $message .= get_option('siteurl') . "\r\n\r\n"; 116 $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; 117 $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n"; 118 $message .= get_option('siteurl') . "/wp-login.php?action=rp&key=$key\r\n"; 119 120 if (FALSE == wp_mail($user_email, sprintf(__('[%s] Password Reset'), get_option('blogname')), $message)) { 121 die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>'); 122 } else { 123 wp_redirect('wp-login.php?checkemail=confirm'); 124 exit(); 125 } 126 } 127 } 128 } 129 130 if ( 'invalidkey' == $_GET['error'] ) $errors['invalidkey'] = __('Sorry, that key does not appear to be valid.'); 131 132 do_action('lost_password'); 133 login_header(__('Lost Password'), '<p class="message">' . __('Please enter your username and e-mail address. You will recieve a new password via e-mail.') . '</p>'); 69 134 ?> 70 135 71 <form name="lostpass" action="wp-login.php" method="post" id="lostpass"> 72 <p> 73 <input type="hidden" name="action" value="retrievepassword" /> 74 <label><?php _e('Username:') ?><br /> 75 <input type="text" name="user_login" id="user_login" value="" size="20" tabindex="1" /></label></p> 76 <p><label><?php _e('E-mail:') ?><br /> 77 <input type="text" name="email" id="email" value="" size="25" tabindex="2" /></label><br /> 78 </p> 79 <p class="submit"><input type="submit" name="submit" id="submit" value="<?php _e('Retrieve Password »'); ?>" tabindex="3" /></p> 136 <form name="lostpasswordform" id="lostpasswordform" action="wp-login.php?action=lostpassword" method="post"> 137 <p> 138 <label><?php _e('Username:') ?><br /> 139 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo wp_specialchars(stripslashes($_POST['user_login']), 1); ?>" size="20" tabindex="10" /></label> 140 </p> 141 <p> 142 <label><?php _e('E-mail:') ?><br /> 143 <input type="text" name="user_email" id="user_email" class="input" value="<?php echo wp_specialchars(stripslashes($_POST['user_email']), 1); ?>" size="25" tabindex="20" /></label> 144 </p> 145 <?php do_action('lostpassword_form'); ?> 146 <p class="submit"><input type="submit" name="submit" id="submit" value="<?php _e('Get New Password »'); ?>" tabindex="100" /></p> 80 147 </form> 81 148 <ul> 149 <?php if (get_option('users_can_register')) : ?> 150 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Login') ?></a></li> 151 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=register"><?php _e('Register') ?></a></li> 152 <li><a href="<?php bloginfo('home'); ?>/" title="<?php _e('Are you lost?') ?>" class="fullwidth">« <?php _e('Back to blog') ?></a></li> 153 <?php else : ?> 82 154 <li><a href="<?php bloginfo('home'); ?>/" title="<?php _e('Are you lost?') ?>">« <?php _e('Back to blog') ?></a></li> 83 <?php if (get_option('users_can_register')) : ?> 84 <li><a href="<?php bloginfo('wpurl'); ?>/wp-register.php"><?php _e('Register') ?></a></li> 155 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Login') ?></a></li> 85 156 <?php endif; ?> 86 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Login') ?></a></li>87 157 </ul> 88 158 </div> … … 92 162 break; 93 163 94 case 'retrievepassword':95 $user_data = get_userdatabylogin(trim($_POST['user_login']));96 // redefining user_login ensures we return the right case in the email97 $user_login = $user_data->user_login;98 $user_email = $user_data->user_email;99 100 if (!$user_email || $user_email != $_POST['email'])101 wp_die(sprintf(__('Sorry, that user does not seem to exist in our database. Perhaps you have the wrong username or e-mail address? <a href="%s">Try again</a>.'), 'wp-login.php?action=lostpassword'));102 103 do_action('retreive_password', $user_login); // Misspelled and deprecated.104 do_action('retrieve_password', $user_login);105 106 // Generate something random for a password... md5'ing current time with a rand salt107 $key = substr( md5( uniqid( microtime() ) ), 0, 8);108 // now insert the new pass md5'd into the db109 $wpdb->query("UPDATE $wpdb->users SET user_activation_key = '$key' WHERE user_login = '$user_login'");110 $message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n";111 $message .= get_option('siteurl') . "\r\n\r\n";112 $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";113 $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";114 $message .= get_option('siteurl') . "/wp-login.php?action=rp&key=$key\r\n";115 116 $m = wp_mail($user_email, sprintf(__('[%s] Password Reset'), get_option('blogname')), $message);117 118 if ($m == false) {119 echo '<p>' . __('The e-mail could not be sent.') . "<br />\n";120 echo __('Possible reason: your host may have disabled the mail() function...') . "</p>";121 die();122 } else {123 echo '<p>' . sprintf(__("The e-mail was sent successfully to %s's e-mail address."), $user_login) . '<br />';124 echo "<a href='wp-login.php' title='" . __('Check your e-mail first, of course') . "'>" . __('Click here to login!') . '</a></p>';125 die();126 }127 128 break;129 130 164 case 'resetpass' : 131 165 case 'rp' : 166 $key = preg_replace('/a-z0-9/i', '', $_GET['key']); 167 if ( empty( $key ) ) { 168 wp_redirect('wp-login.php?action=lostpassword&error=invalidkey'); 169 exit(); 170 } 171 172 $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_activation_key = '$key'"); 173 if ( empty( $user ) ) { 174 wp_redirect('wp-login.php?action=lostpassword&error=invalidkey'); 175 exit(); 176 } 177 178 do_action('password_reset'); 179 132 180 // Generate something random for a password... md5'ing current time with a rand salt 133 $key = preg_replace('/a-z0-9/i', '', $_GET['key']);134 if ( empty($key) )135 wp_die( __('Sorry, that key does not appear to be valid.') );136 $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_activation_key = '$key'");137 if ( !$user )138 wp_die( __('Sorry, that key does not appear to be valid.') );139 140 do_action('password_reset');141 142 181 $new_pass = substr( md5( uniqid( microtime() ) ), 0, 7); 143 182 $wpdb->query("UPDATE $wpdb->users SET user_pass = MD5('$new_pass'), user_activation_key = '' WHERE user_login = '$user->user_login'"); 144 183 wp_cache_delete($user->ID, 'users'); 145 184 wp_cache_delete($user->user_login, 'userlogins'); … … 148 187 $message .= get_option('siteurl') . "/wp-login.php\r\n"; 149 188 150 $m = wp_mail($user->user_email, sprintf(__('[%s] Your new password'), get_option('blogname')), $message); 151 152 if ($m == false) { 153 echo '<p>' . __('The e-mail could not be sent.') . "<br />\n"; 154 echo __('Possible reason: your host may have disabled the mail() function...') . '</p>'; 155 die(); 189 if (FALSE == wp_mail($user->user_email, sprintf(__('[%s] Your new password'), get_option('blogname')), $message)) { 190 die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>'); 156 191 } else { 157 echo '<p>' . sprintf(__('Your new password is in the mail.'), $user_login) . '<br />';158 echo "<a href='wp-login.php' title='" . __('Check your e-mail first, of course') . "'>" . __('Click here to login!') . '</a></p>';159 192 // send a copy of password change notification to the admin 160 193 $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n"; 161 194 wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), get_option('blogname')), $message); 162 die(); 163 } 195 196 wp_redirect('wp-login.php?checkemail=newpass'); 197 exit(); 198 } 199 break; 200 201 case 'register' : 202 if ( FALSE == get_option('users_can_register') ) { 203 wp_redirect('wp-login.php?registration=disabled'); 204 exit(); 205 } 206 207 if ( $_POST ) { 208 require_once( ABSPATH . WPINC . '/registration.php'); 209 210 $user_login = sanitize_user( $_POST['user_login'] ); 211 $user_email = $_POST['user_email']; 212 213 // Check the username 214 if ( $user_login == '' ) 215 $errors['user_login'] = __('<strong>ERROR</strong>: Please enter a username.'); 216 elseif ( !validate_username( $user_login ) ) { 217 $errors['user_login'] = __('<strong>ERROR</strong>: This username is invalid. Please enter a valid username.'); 218 $user_login = ''; 219 } elseif ( username_exists( $user_login ) ) 220 $errors['user_login'] = __('<strong>ERROR</strong>: This username is already registered, please choose another one.'); 221 222 // Check the e-mail address 223 if ($user_email == '') { 224 $errors['user_email'] = __('<strong>ERROR</strong>: Please type your e-mail address.'); 225 } elseif ( !is_email( $user_email ) ) { 226 $errors['user_email'] = __('<strong>ERROR</strong>: The email address isn’t correct.'); 227 $user_email = ''; 228 } elseif ( email_exists( $user_email ) ) 229 $errors['user_email'] = __('<strong>ERROR</strong>: This email is already registered, please choose another one.'); 230 231 do_action('register_post'); 232 233 if ( empty( $errors ) ) { 234 $user_pass = substr( md5( uniqid( microtime() ) ), 0, 7); 235 236 $user_id = wp_create_user( $user_login, $user_pass, $user_email ); 237 if ( !$user_id ) 238 $errors['registerfail'] = sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_option('admin_email')); 239 else { 240 wp_new_user_notification($user_id, $user_pass); 241 242 wp_redirect('wp-login.php?checkemail=registered'); 243 exit(); 244 } 245 } 246 } 247 248 login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>'); 249 ?> 250 251 <form name="registerform" id="registerform" action="wp-login.php?action=register" method="post"> 252 <p> 253 <label><?php _e('Username:') ?><br /> 254 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo wp_specialchars(stripslashes($user_login), 1); ?>" size="20" tabindex="10" /></label> 255 </p> 256 <p> 257 <label><?php _e('E-mail:') ?><br /> 258 <input type="text" name="user_email" id="user_email" class="input" value="<?php echo wp_specialchars(stripslashes($user_email), 1); ?>" size="25" tabindex="20" /></label> 259 </p> 260 <?php do_action('register_form'); ?> 261 <p id="reg_passmail"><?php _e('A password will be e-mailed to you.') ?></p> 262 <p class="submit"><input type="submit" name="submit" id="submit" value="<?php _e('Register »'); ?>" tabindex="100" /></p> 263 </form> 264 <ul> 265 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Login') ?></a></li> 266 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a></li> 267 <li><a href="<?php bloginfo('home'); ?>/" title="<?php _e('Are you lost?') ?>" class="fullwidth">« <?php _e('Back to blog') ?></a></li> 268 </ul> 269 </div> 270 </body> 271 </html> 272 <?php 164 273 break; 165 274 166 275 case 'login' : 167 276 default: 168 169 277 $user_login = ''; 170 278 $user_pass = ''; 171 $using_cookie = false; 279 $using_cookie = FALSE; 280 172 281 if ( !isset( $_REQUEST['redirect_to'] ) ) 173 282 $redirect_to = 'wp-admin/'; … … 175 284 $redirect_to = $_REQUEST['redirect_to']; 176 285 177 if ( $_POST ) {178 $user_login = $_POST[' log'];286 if ( $_POST ) { 287 $user_login = $_POST['user_login']; 179 288 $user_login = sanitize_user( $user_login ); 180 $user_pass = $_POST[' pwd'];289 $user_pass = $_POST['user_pass']; 181 290 $rememberme = $_POST['rememberme']; 182 291 } else { … … 191 300 do_action_ref_array('wp_authenticate', array(&$user_login, &$user_pass)); 192 301 193 if ( $user_login && $user_pass ) {302 if ( $user_login && $user_pass && empty( $errors ) ) { 194 303 $user = new WP_User(0, $user_login); 195 304 … … 203 312 do_action('wp_login', $user_login); 204 313 wp_redirect($redirect_to); 205 exit ;314 exit(); 206 315 } else { 207 316 if ( $using_cookie ) 208 $error = __('Your session has expired.'); 209 } 210 } else if ( $user_login || $user_pass ) { 211 $error = __('<strong>Error</strong>: The password field is empty.'); 212 } 317 $errors['expiredsession'] = __('Your session has expired.'); 318 } 319 } 320 321 if ( $_POST && empty( $user_login ) ) 322 $errors['user_login'] = __('<strong>ERROR</strong>: The username field is empty.'); 323 if ( $_POST && empty( $user_pass ) ) 324 $errors['user_pass'] = __('<strong>ERROR</strong>: The password field is empty.'); 325 326 // Some parts of this script use the main login form to display a message 327 if ( TRUE == $_GET['loggedout'] ) $errors['loggedout'] = __('Successfully logged you out.'); 328 elseif ( 'disabled' == $_GET['registration'] ) $errors['registerdiabled'] = __('User registration is currently not allowed.'); 329 elseif ( 'confirm' == $_GET['checkemail'] ) $errors['confirm'] = __('Check your e-mail for the confirmation link.'); 330 elseif ( 'newpass' == $_GET['checkemail'] ) $errors['newpass'] = __('Check your e-mail for your new password.'); 331 elseif ( 'registered' == $_GET['checkemail'] ) $errors['registered'] = __('Registration complete. Please check your e-mail.'); 332 333 login_header(__('Login')); 213 334 ?> 214 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">215 <html xmlns="http://www.w3.org/1999/xhtml">216 <head>217 <title>WordPress › <?php _e('Login') ?></title>218 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />219 <link rel="stylesheet" href="<?php bloginfo('wpurl'); ?>/wp-admin/wp-admin.css" type="text/css" />220 <script type="text/javascript">221 function focusit() {222 document.getElementById('log').focus();223 }224 window.onload = focusit;225 </script>226 </head>227 <body>228 229 <div id="login">230 <h1><a href="http://wordpress.org/">WordPress</a></h1>231 <?php232 if ( $error )233 echo "<div id='login_error'>$error</div>";234 ?>235 335 236 336 <form name="loginform" id="loginform" action="wp-login.php" method="post"> 237 <p><label><?php _e('Username:') ?><br /><input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1); ?>" size="20" tabindex="1" /></label></p> 238 <p><label><?php _e('Password:') ?><br /> <input type="password" name="pwd" id="pwd" value="" size="20" tabindex="2" /></label></p> 239 <p> 240 <label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="3" /> 241 <?php _e('Remember me'); ?></label></p> 242 <p class="submit"> 243 <input type="submit" name="submit" id="submit" value="<?php _e('Login'); ?> »" tabindex="4" /> 244 <input type="hidden" name="redirect_to" value="<?php echo wp_specialchars($redirect_to); ?>" /> 245 </p> 337 <p> 338 <label><?php _e('Username:') ?><br /> 339 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo wp_specialchars(stripslashes($user_login), 1); ?>" size="20" tabindex="10" /></label> 340 </p> 341 <p> 342 <label><?php _e('Password:') ?><br /> 343 <input type="password" name="user_pass" id="user_pass" class="input" value="" size="20" tabindex="20" /></label> 344 </p> 345 <?php do_action('login_form'); ?> 346 <p><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> <?php _e('Remember me'); ?></label></p> 347 <p class="submit"> 348 <input type="submit" name="submit" id="submit" value="<?php _e('Login'); ?> »" tabindex="100" /> 349 <input type="hidden" name="redirect_to" value="<?php echo wp_specialchars($redirect_to); ?>" /> 350 </p> 246 351 </form> 247 352 <ul> 353 <?php if (get_option('users_can_register')) : ?> 354 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=register"><?php _e('Register') ?></a></li> 355 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a></li> 356 <li><a href="<?php bloginfo('home'); ?>/" title="<?php _e('Are you lost?') ?>" class="fullwidth">« <?php _e('Back to blog') ?></a></li> 357 <?php else : ?> 248 358 <li><a href="<?php bloginfo('home'); ?>/" title="<?php _e('Are you lost?') ?>">« <?php _e('Back to blog') ?></a></li> 249 <?php if (get_option('users_can_register')) : ?> 250 <li><a href="<?php bloginfo('wpurl'); ?>/wp-register.php"><?php _e('Register') ?></a></li> 359 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a></li> 251 360 <?php endif; ?> 252 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a></li>253 361 </ul> 254 362 </div> -
trunk/wp-register.php
r4144 r4339 1 1 <?php 2 3 # This file is deprecated, but you shouldn't have been linking to it directly anyway :P 4 # Use wp_register() to create a registration link instead, it's much better ;) 5 2 6 require('./wp-config.php'); 3 require_once( ABSPATH . WPINC . '/registration.php'); 4 5 $action = $_REQUEST['action']; 6 if ( !get_option('users_can_register') ) 7 $action = 'disabled'; 8 9 header( 'Content-Type: ' . get_bloginfo('html_type') . '; charset=' . get_bloginfo('charset') ); 10 11 switch( $action ) { 12 13 case 'register': 14 15 $user_login = sanitize_user( $_POST['user_login'] ); 16 $user_email = $_POST['user_email']; 17 18 $errors = array(); 19 20 if ( $user_login == '' ) 21 $errors['user_login'] = __('<strong>ERROR</strong>: Please enter a username.'); 22 23 /* checking e-mail address */ 24 if ($user_email == '') { 25 $errors['user_email'] = __('<strong>ERROR</strong>: Please type your e-mail address.'); 26 } else if (!is_email($user_email)) { 27 $errors['user_email'] = __('<strong>ERROR</strong>: The email address isn’t correct.'); 28 $user_email = ''; 29 } 30 31 if ( ! validate_username($user_login) ) { 32 $errors['user_login'] = __('<strong>ERROR</strong>: This username is invalid. Please enter a valid username.'); 33 $user_login = ''; 34 } 35 36 if ( username_exists( $user_login ) ) 37 $errors['user_login'] = __('<strong>ERROR</strong>: This username is already registered, please choose another one.'); 38 39 if ( email_exists( $user_email ) ) 40 $errors['user_email'] = __('<strong>ERROR</strong>: This email is already registered, please choose another one.'); 41 42 if ( 0 == count($errors) ) { 43 $password = substr( md5( uniqid( microtime() ) ), 0, 7); 44 45 $user_id = wp_create_user( $user_login, $password, $user_email ); 46 if ( !$user_id ) 47 $errors['user_id'] = sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_option('admin_email')); 48 else 49 wp_new_user_notification($user_id, $password); 50 } 51 52 if ( 0 == count($errors) ) { 53 54 ?> 55 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 56 <html xmlns="http://www.w3.org/1999/xhtml"> 57 <head> 58 <title>WordPress » <?php _e('Registration Complete') ?></title> 59 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" /> 60 <link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css" /> 61 <style type="text/css"> 62 .submit { 63 font-size: 1.7em; 64 } 65 </style> 66 </head> 67 <body> 68 69 <div id="login"> 70 <h2><?php _e('Registration Complete') ?></h2> 71 <p><?php printf(__('Username: %s'), "<strong>" . wp_specialchars($user_login) . "</strong>") ?><br /> 72 <?php printf(__('Password: %s'), '<strong>' . __('emailed to you') . '</strong>') ?> <br /> 73 <?php printf(__('E-mail: %s'), "<strong>" . wp_specialchars($user_email) . "</strong>") ?></p> 74 <p class="submit"><a href="wp-login.php"><?php _e('Login »'); ?></a></p> 75 </div> 76 </body> 77 </html> 78 79 <?php 80 break; 81 } 82 83 default: 7 wp_redirect('wp-login.php?action=register'); 8 exit(); 84 9 85 10 ?> 86 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">87 <html xmlns="http://www.w3.org/1999/xhtml">88 <head>89 <title>WordPress » <?php _e('Registration Form') ?></title>90 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />91 <link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css" />92 <style type="text/css">93 #user_email, #user_login, #submit {94 font-size: 1.7em;95 }96 </style>97 </head>98 99 <body>100 <div id="login">101 <h1><a href="http://wordpress.org/">WordPress</a></h1>102 <h2><?php _e('Register for this blog') ?></h2>103 <?php if ( isset($errors) ) : ?>104 <div class="error">105 <p>106 <?php107 foreach($errors as $error) echo "$error<br />";108 ?>109 </p>110 </div>111 <?php endif; ?>112 <form method="post" action="wp-register.php" id="registerform">113 <p><input type="hidden" name="action" value="register" />114 <label for="user_login"><?php _e('Username:') ?></label><br /> <input type="text" name="user_login" id="user_login" size="20" maxlength="20" value="<?php echo wp_specialchars($user_login); ?>" /><br /></p>115 <p><label for="user_email"><?php _e('E-mail:') ?></label><br /> <input type="text" name="user_email" id="user_email" size="25" maxlength="100" value="<?php echo wp_specialchars($user_email); ?>" /></p>116 <p><?php _e('A password will be emailed to you.') ?></p>117 <p class="submit"><input type="submit" value="<?php _e('Register »') ?>" id="submit" name="submit" /></p>118 </form>119 <ul>120 <li><a href="<?php bloginfo('home'); ?>/" title="<?php _e('Are you lost?') ?>">« <?php _e('Back to blog') ?></a></li>121 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Login') ?></a></li>122 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a></li>123 </ul>124 </div>125 126 </body>127 </html>128 <?php129 130 break;131 132 case 'disabled':133 134 ?>135 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">136 <html xmlns="http://www.w3.org/1999/xhtml">137 <head>138 <title>WordPress » <?php _e('Registration Currently Disabled') ?></title>139 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />140 <link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css">141 </head>142 143 <body>144 145 <div id="login">146 <h2><?php _e('Registration Disabled') ?></h2>147 <p><?php _e('User registration is currently not allowed.') ?><br />148 <a href="<?php echo get_option('home'); ?>/" title="<?php _e('Go back to the blog') ?>"><?php _e('Home') ?></a>149 </p>150 </div>151 152 </body>153 </html>154 155 <?php156 break;157 158 }159 ?>
Note: See TracChangeset
for help on using the changeset viewer.