mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Big buttons for login and registration, more robust registration and password recovery.
git-svn-id: https://develop.svn.wordpress.org/trunk@2215 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
+30
-28
@@ -26,8 +26,6 @@ switch($action) {
|
||||
case 'register':
|
||||
|
||||
$user_login = $_POST['user_login'];
|
||||
$pass1 = $_POST['pass1'];
|
||||
$pass2 = $_POST['pass2'];
|
||||
$user_email = $_POST['user_email'];
|
||||
|
||||
/* checking login has been typed */
|
||||
@@ -35,17 +33,6 @@ case 'register':
|
||||
die (__('<strong>ERROR</strong>: Please enter a login.'));
|
||||
}
|
||||
|
||||
/* checking the password has been typed twice */
|
||||
if ($pass1 == '' || $pass2 == '') {
|
||||
die (__('<strong>ERROR</strong>: Please enter your password twice.'));
|
||||
}
|
||||
|
||||
/* checking the password has been typed twice the same */
|
||||
if ($pass1 != $pass2) {
|
||||
die (__('<strong>ERROR</strong>: Please type the same password in the two password fields.'));
|
||||
}
|
||||
$user_nickname = $user_login;
|
||||
|
||||
/* checking e-mail address */
|
||||
if ($user_email == '') {
|
||||
die (__('<strong>ERROR</strong>: Please type your e-mail address.'));
|
||||
@@ -63,17 +50,17 @@ case 'register':
|
||||
|
||||
$user_browser = $wpdb->escape($_SERVER['HTTP_USER_AGENT']);
|
||||
|
||||
$user_login = $wpdb->escape($user_login);
|
||||
$pass1 = $wpdb->escape($pass1);
|
||||
$user_nickname = $wpdb->escape($user_nickname);
|
||||
$user_nicename = sanitize_title($user_nickname);
|
||||
$user_login = $wpdb->escape( preg_replace('|a-z0-9 _.-|i', '', $user_login) );
|
||||
$user_nickname = $user_login;
|
||||
$user_nicename = sanitize_title($user_nickname);
|
||||
$now = gmdate('Y-m-d H:i:s');
|
||||
if (get_settings('new_users_can_blog') >= 1) $user_level = 1;
|
||||
$password = substr( md5( uniqid( microtime() ) ), 0, 7);
|
||||
|
||||
$result = $wpdb->query("INSERT INTO $wpdb->users
|
||||
(user_login, user_pass, user_nickname, user_email, user_ip, user_browser, user_registered, user_level, user_idmode, user_nicename)
|
||||
VALUES
|
||||
('$user_login', MD5('$pass1'), '$user_nickname', '$user_email', '$user_ip', '$user_browser', '$now', '$user_level', 'nickname', '$user_nicename')");
|
||||
('$user_login', MD5('$password'), '$user_nickname', '$user_email', '$user_ip', '$user_browser', '$now', '$user_level', 'nickname', '$user_nicename')");
|
||||
|
||||
if ($result == false) {
|
||||
die (sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_settings('admin_email')));
|
||||
@@ -83,6 +70,12 @@ case 'register':
|
||||
for ($i = 0; $i < strlen($pass1); $i = $i + 1) {
|
||||
$stars .= '*';
|
||||
}
|
||||
|
||||
$message = __('Login') . ": $user_login\r\n";
|
||||
$message .= __('Password') . ": $new_pass\r\n";
|
||||
$message .= get_settings('siteurl') . '/wp-login.php';
|
||||
|
||||
wp_mail($user_email, sprintf(__("[%s] Your login information"), get_settings('blogname')), $message);
|
||||
|
||||
$message = sprintf(__("New user registration on your blog %1\$s:\n\nLogin: %2\$s \n\nE-mail: %3\$s"), get_settings('blogname'), $user_login, $user_email);
|
||||
|
||||
@@ -101,7 +94,7 @@ case 'register':
|
||||
<div id="login">
|
||||
<h2><?php _e('Registration Complete') ?></h2>
|
||||
<p><?php _e('Login:') ?> <strong><?php echo $user_login; ?></strong><br />
|
||||
<?php _e('Password:') ?> <strong><?php echo $stars; ?></strong><br />
|
||||
<?php _e('Password:') ?> <strong>emailed to you</strong><br />
|
||||
<?php _e('E-mail:') ?> <strong><?php echo $user_email; ?></strong></p>
|
||||
<form action="wp-login.php" method="post" name="login">
|
||||
<input type="hidden" name="log" value="<?php echo $user_login; ?>" />
|
||||
@@ -149,21 +142,30 @@ default:
|
||||
<title>WordPress » <?php _e('Registration Form') ?></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo get_settings('blog_charset'); ?>" />
|
||||
<link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css" />
|
||||
<style type="text/css">
|
||||
#user_email, #user_login, #submit {
|
||||
font-size: 1.7em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="login">
|
||||
<h2><?php _e('Registration') ?></h2>
|
||||
<h1><a href="http://wordpress.org/">WordPress</a></h1>
|
||||
<h2><?php _e('Register for this blog') ?></h2>
|
||||
|
||||
<form method="post" action="wp-register.php">
|
||||
<input type="hidden" name="action" value="register" />
|
||||
<label for="user_login"><?php _e('Login:') ?></label> <input type="text" name="user_login" id="user_login" size="10" maxlength="20" /><br />
|
||||
<label for="pass1"><?php _e('Password:') ?></label> <input type="password" name="pass1" id="pass1" size="10" maxlength="100" /><br />
|
||||
|
||||
<input type="password" name="pass2" size="10" maxlength="100" /><br />
|
||||
<label for="user_email"><?php _e('E-mail') ?></label>: <input type="text" name="user_email" id="user_email" size="15" maxlength="100" /><br />
|
||||
<input type="submit" value="<?php _e('OK') ?>" class="search" name="submit" />
|
||||
<form method="post" action="wp-register.php" id="registerform">
|
||||
<p><input type="hidden" name="action" value="register" />
|
||||
<label for="user_login"><?php _e('Login:') ?></label><br /> <input type="text" name="user_login" id="user_login" size="20" maxlength="20" /><br /></p>
|
||||
<p><label for="user_email"><?php _e('E-mail') ?></label>:<br /> <input type="text" name="user_email" id="user_email" size="25" maxlength="100" /></p>
|
||||
<p>A password will be emailed to you.</p>
|
||||
<p class="submit"><input type="submit" value="<?php _e('Register') ?> »" id="submit" name="submit" /></p>
|
||||
</form>
|
||||
<ul>
|
||||
<li><a href="<?php bloginfo('home'); ?>" title="<?php _e('Are you lost?') ?>">« <?php _e('Back to blog') ?></a></li>
|
||||
<li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Login') ?></a></li>
|
||||
<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>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user