Major overhaul of Special:Userlogin
authorTom Gilder <tomgilder@users.mediawiki.org>
Fri, 2 Dec 2005 00:14:58 +0000 (00:14 +0000)
committerTom Gilder <tomgilder@users.mediawiki.org>
Fri, 2 Dec 2005 00:14:58 +0000 (00:14 +0000)
 * Split up login and create user forms
 * New design for forms
 * Many usability improvements
 * Better error messages

RELEASE-NOTES
includes/SpecialUserlogin.php
includes/templates/Userlogin.php
languages/Language.php
skins/monobook/main.css
skins/monobook/rtl.css

index c6e7226..763a587 100644 (file)
@@ -272,7 +272,7 @@ fully support the editing toolbar, but was found to be too confusing.
 * Include oldid for the second revision on edit link on diff view
 * (bug 4035) Fix prev/next revision links on edit page
 * Fix custom namespaces on wikis set for Portuguese
-
+* Major overhaul of Special:Userlogin
 
 === Caveats ===
 
index e922426..416703e 100644 (file)
@@ -37,6 +37,7 @@ class LoginForm {
                global $wgLang, $wgAllowRealName, $wgEnableEmail;
                global $wgAuth;
 
+               $this->mType = $request->getText( 'type' );
                $this->mName = $request->getText( 'wpName' );
                $this->mPassword = $request->getText( 'wpPassword' );
                $this->mRetype = $request->getText( 'wpRetype' );
@@ -311,7 +312,7 @@ class LoginForm {
                }
 
                if (!$u->checkPassword( $this->mPassword )) {
-                       $this->mainLoginForm( wfMsg( 'wrongpassword' ) );
+                       $this->mainLoginForm( wfMsg( $this->mPassword == '' ? 'wrongpasswordempty' : 'wrongpassword' ) );
                        return;
                }
 
@@ -447,14 +448,33 @@ class LoginForm {
                        }
                }
 
-               $q = 'action=submitlogin';
-               if ( !empty( $this->mReturnto ) ) {
-                       $q .= '&returnto=' . wfUrlencode( $this->mReturnto );
-               }
                $titleObj = Title::makeTitle( NS_SPECIAL, 'Userlogin' );
 
                require_once( 'templates/Userlogin.php' );
-               $template =& new UserloginTemplate();
+
+               if ( $this->mType == 'signup' ) {
+                       $template =& new UsercreateTemplate();
+                       $q = 'action=submitlogin&type=signup';
+                       $linkq = 'type=login';
+                       $msg = 'gotaccount';
+               } else {
+                       $template =& new UserloginTemplate();
+                       $q = 'action=submitlogin&type=login';
+                       $linkq = 'type=signup';
+                       $msg = 'nologin';
+               }
+
+               if ( !empty( $this->mReturnto ) ) {
+                       $returnto = '&returnto=' . wfUrlencode( $this->mReturnto );
+                       $q .= $returnto;
+                       $linkq .= $returnto;
+               }
+
+               $link = '<a href="' . htmlspecialchars ( $titleObj->getLocalUrl( $linkq ) ) . '">';
+               $link .= wfMsgHtml( $msg . 'link' );
+               $link .= '</a>';
+
+               $template->set( 'link', wfMsgHtml( $msg, $link ) );
                
                $template->set( 'name', $this->mName );
                $template->set( 'password', $this->mPassword );
index 5fcd915..7a6f03a 100644 (file)
@@ -17,36 +17,103 @@ class UserloginTemplate extends QuickTemplate {
        function execute() {
                if( $this->data['error'] ) {
 ?>
-       <h2><?php $this->msg('loginerror') ?>:</h2>
-       <p class='error'><?php $this->html('error') ?></p>
-<?php } else { ?>
-       <h2><?php $this->msg('login'      ) ?>:</h2>
-       <?php  $this->msgWiki('loginprompt') ?>
+       <div class="errorbox">
+               <h2><?php $this->msg('loginerror') ?>:</h2>
+               <?php $this->html('error') ?>
+       </div>
+       <div class="visualClear"></div>
 <?php } ?>
-<form name="userlogin" id="userlogin" method="post" action="<?php $this->text('action') ?>">
-       <table border='0'>
+
+<div id="userlogin">
+<form name="userlogin" method="post" action="<?php $this->text('action') ?>">
+       <h2><?php $this->msg('login') ?></h2>
+       <p id="userloginlink"><?php $this->html('link') ?></p>
+       <div id="userloginprompt"><?php  $this->msgWiki('loginprompt') ?></div>
+       <table>
                <tr>
-                       <td align='right'><label for='wpName'><?php $this->msg('yourname') ?>:</label></td>
+                       <td align='right'><label for='wpName1'><?php $this->msg('yourname') ?>:</label></td>
                        <td align='left'>
-                               <input tabindex='1' type='text' name="wpName" id="wpName"
+                               <input type='text' class='loginText' name="wpName" id="wpName1"
                                        value="<?php $this->text('name') ?>" size='20' />
                        </td>
+               </tr>
+               <tr>
+                       <td align='right'><label for='wpPassword1'><?php $this->msg('yourpassword') ?>:</label></td>
+                       <td align='left'>
+                               <input type='password' class='loginPassword' name="wpPassword" id="wpPassword1"
+                                       value="<?php $this->text('password') ?>" size='20' />
+                       </td>
+               </tr>
+       <?php if( $this->data['usedomain'] ) {
+               $doms = "";
+               foreach( $this->data['domainnames'] as $dom ) {
+                       $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
+               }
+       ?>
+               <tr>
+                       <td align='right'><?php $this->msg( 'yourdomainname' ) ?>:</td>
+                       <td align='left'>
+                               <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>">
+                                       <?php echo $doms ?>
+                               </select>
+                       </td>
+               </tr>
+       <?php } ?>
+               <tr>
+                       <td></td>
                        <td align='left'>
-                               <input tabindex='3' type='checkbox' name="wpRemember"
+                               <input type='checkbox' name="wpRemember"
                                        value="1" id="wpRemember"
                                        <?php if( $this->data['remember'] ) { ?>checked="checked"<?php } ?>
-                                       /><label for="wpRemember"><?php $this->msg('remembermypassword') ?></label>
+                                       /> <label for="wpRemember"><?php $this->msg('remembermypassword') ?></label>
                        </td>
                </tr>
                <tr>
-                       <td align='right'><label for='wpPassword'><?php $this->msg('yourpassword') ?>:</label></td>
+                       <td></td>
+                       <td align='left' style="white-space:nowrap">
+                               <input type='submit' name="wpLoginattempt" id="wpLoginattempt" value="<?php $this->msg('login') ?>" />&nbsp;<?php if( $this->data['useemail'] ) { ?><input type='submit' name="wpMailmypassword"
+                                                                       value="<?php $this->msg('mailmypassword') ?>" />
+                               <?php } ?>
+                       </td>
+               </tr>
+       </table>
+</form>
+</div>
+<div id="loginend"><?php $this->msgWiki( 'loginend' ); ?></div>
+<?php
+
+       }
+}
+
+class UsercreateTemplate extends QuickTemplate {
+       function execute() {
+               if( $this->data['error'] ) {
+?>
+       <div class="errorbox">
+               <h2><?php $this->msg('loginerror') ?>:</h2>
+               <?php $this->html('error') ?>
+       </div>
+       <div class="visualClear"></div>
+<?php } ?>
+<div id="userlogin">
+
+<?php if( $this->data['create'] ) { ?>
+<form name="userlogin2" id="userlogin2" method="post" action="<?php $this->text('action') ?>">
+       <h2><?php $this->msg('createaccount') ?></h2>
+       <p id="userloginlink"><?php $this->html('link') ?></p>
+       <table>
+               <tr>
+                       <td align='right'><label for='wpName2'><?php $this->msg('yourname') ?>:</label></td>
                        <td align='left'>
-                               <input tabindex='2' type='password' name="wpPassword" id="wpPassword"
-                                       value="<?php $this->text('password') ?>" size='20' />
+                               <input type='text' class='loginText' name="wpName" id="wpName2"
+                                       value="<?php $this->text('name') ?>" size='20' />
                        </td>
+               </tr>
+               <tr>
+                       <td align='right'><label for='wpPassword2'><?php $this->msg('yourpassword') ?>:</label></td>
                        <td align='left'>
-                               <input tabindex='4' type='submit' name="wpLoginattempt"
-                                       value="<?php $this->msg('login') ?>" />
+                               <input type='password' class='loginPassword' name="wpPassword" id="wpPassword2"
+                                       value="<?php $this->text('password') ?>" size='20' />
                        </td>
                </tr>
        <?php if( $this->data['usedomain'] ) {
@@ -58,30 +125,25 @@ class UserloginTemplate extends QuickTemplate {
                <tr>
                        <td align='right'><?php $this->msg( 'yourdomainname' ) ?>:</td>
                        <td align='left'>
-                               <select tabindex='11' name="wpDomain" value="<?php $this->text( 'domain' ) ?>">
+                               <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>">
                                        <?php echo $doms ?>
                                </select>
                        </td>
                </tr>
        <?php } ?>
-       <?php if( $this->data['create'] ) { ?>
-               <tr>
-                       <td colspan='3'>&nbsp;</td>
-               </tr>
                <tr>
                        <td align='right'><label for='wpRetype'><?php $this->msg('yourpasswordagain') ?>:</label></td>
                        <td align='left'>
-                               <input tabindex='5' type='password' name="wpRetype" id="wpRetype"
+                               <input type='password' class='loginPassword' name="wpRetype" id="wpRetype"
                                        value="<?php $this->text('retype') ?>" 
                                        size='20' />
                        </td>
-                       <td><?php $this->msg('newusersonly') ?></td>
                </tr>
                <tr>
                        <?php if( $this->data['useemail'] ) { ?>
                                <td align='right'><label for='wpEmail'><?php $this->msg('youremail') ?>:</label></td>
                                <td align='left'>
-                                       <input tabindex='7' type='text' name="wpEmail" id="wpEmail"
+                                       <input type='text' class='loginText' name="wpEmail" id="wpEmail"
                                                value="<?php $this->text('email') ?>" size='20' />
                                </td>
                        <?php } ?>
@@ -90,38 +152,47 @@ class UserloginTemplate extends QuickTemplate {
                                <tr>
                                        <td align='right'><label for='wpRealName'><?php $this->msg('yourrealname') ?>:</label></td>
                                        <td align='left'>
-                                               <input tabindex='8' type='text' name="wpRealName" id="wpRealName"
+                                               <input type='text' class='loginText' name="wpRealName" id="wpRealName"
                                                        value="<?php $this->text('realname') ?>" size='20' />
                                        </td>
                        <?php } ?>
+               </tr>
+               <tr>
+                       <td></td>
                        <td align='left'>
-                               <input tabindex='9' type='submit' name="wpCreateaccount"
+                               <input type='checkbox' name="wpRemember"
+                                       value="1" id="wpRemember"
+                                       <?php if( $this->data['remember'] ) { ?>checked="checked"<?php } ?>
+                                       /> <label for="wpRemember"><?php $this->msg('remembermypassword') ?></label>
+                       </td>
+               </tr>
+               <tr>
+                       <td></td>
+                       <td align='left'>
+                               <input type='submit' name="wpCreateaccount" id="wpCreateaccount"
                                        value="<?php $this->msg('createaccount') ?>" />
                                <?php if( $this->data['createemail'] ) { ?>
-                               <input tabindex='6' type='submit' name="wpCreateaccountMail"
+                               <input type='submit' name="wpCreateaccountMail" id="wpCreateaccountMail"
                                        value="<?php $this->msg('createaccountmail') ?>" />
                                <?php } ?>
                        </td>
                </tr>
        <?php } ?>
-       <?php if( $this->data['useemail'] ) { ?>
-               <tr>
-                       <td colspan='3'>&nbsp;</td>
-               </tr>
-               <tr>
-                       <td colspan='3' align='left'>
-                               <p>
-                                       <?php $this->msgHtml( 'emailforlost' ) ?><br />
-                                       <input tabindex='10' type='submit' name="wpMailmypassword"
-                                               value="<?php $this->msg('mailmypassword') ?>" />
-                               </p>
-                       </td>
-               </tr>
-       <?php } ?>
        </table>
+       <?php
+               
+               if( $this->data['useemail'] ) {
+                       echo '<div id="login-emailforlost">';
+                       $this->msgHtml( 'emailforlost' );
+                       echo '</div>';
+               }
+
+       ?>
 </form>
+</div>
+<div id="signupend"><?php $this->msgWiki( 'signupend' ); ?></div>
 <?php
-               $this->msgWiki( 'loginend' );
+
        }
 }
 
index d9c9ee3..09ea330 100644 (file)
@@ -590,7 +590,7 @@ You can view and copy the source of this page:',
 # Login and logout pages
 #
 'logouttitle'  => 'User logout',
-'logouttext'           => "You are now logged out.<br />
+'logouttext'           => "<strong>You are now logged out.</strong><br />
 You can continue to use {{SITENAME}} anonymously, or you can log in
 again as the same or as a different user. Note that some pages may
 continue to be displayed as if you were still logged in, until you clear
@@ -613,14 +613,18 @@ Your account has been created. Don't forget to change your {{SITENAME}} preferen
 
 'login'                        => 'Log in',
 'loginprompt'  => 'You must have cookies enabled to log in to {{SITENAME}}.',
-'userlogin'            => 'Create an account or log in',
+'userlogin'            => 'Log in / create account',
 'logout'               => 'Log out',
 'userlogout'   => 'Log out',
 'notloggedin'  => 'Not logged in',
-'createaccount'        => 'Create new account',
+'nologin'      => 'Don\'t have a login? $1.',
+'nologinlink'  => 'Create an account',
+'createaccount'        => 'Create account',
+'gotaccount'   => 'Already got an account? $1.',
+'gotaccountlink'       => 'Log in',
 'createaccountmail'    => 'by email',
 'badretype'            => 'The passwords you entered do not match.',
-'userexists'   => 'The user name you entered is already in use. Please choose a different name.',
+'userexists'   => 'Username entered already in use. Please choose a different name.',
 'youremail'            => 'Email *',
 'username'             => 'Username: ',
 'uid'                  => 'User ID: ',
@@ -630,8 +634,7 @@ Your account has been created. Don't forget to change your {{SITENAME}} preferen
 'yournick'             => 'Nickname:',
 'badsig'               => 'Invalid raw signature; check HTML tags.',
 'email'                        => 'Email',
-'emailforlost'         => "Fields marked with superscripts are optional.  Storing an email address enables people to contact you through the website without you having to reveal your
-email address to them, and it can be used to send you a new password if you forget it.<br /><br />Your real name, if you choose to provide it, will be used for giving you attribution for your work.",
+'emailforlost'         => "<div style='width:30em'>* Optional. An email lets others contact you on this site without revealing your address, and lets us send you a new password if you forget it.<br /><br />Your real name will be used to give you attribution for your work.</div>",
 'prefs-help-email-enotif' => 'This address is also used to send you email notifications if you enabled the options.',
 'prefs-help-realname'  => '* Real name (optional): if you choose to provide it this will be used for giving you attribution for your work.',
 'loginerror'   => 'Login error',
@@ -640,12 +643,12 @@ email address to them, and it can be used to send you a new password if you forg
 'nocookieslogin'       => "{{SITENAME}} uses cookies to log in users. You have cookies disabled. Please enable them and try again.",
 'noname'               => 'You have not specified a valid user name.',
 'loginsuccesstitle' => 'Login successful',
-'loginsuccess' => "You are now logged in to {{SITENAME}} as \"$1\".",
-'nosuchuser'   => "There is no user by the name \"$1\".
-Check your spelling, or use the form below to create a new user account.",
+'loginsuccess' => "'''You are now logged in to {{SITENAME}} as \"$1\".'''",
+'nosuchuser'   => "There is no user by the name \"$1\". Check your spelling, or create a new account.",
 'nosuchusershort'      => "There is no user by the name \"$1\". Check your spelling.",
-'wrongpassword'                => 'The password you entered is incorrect (or missing). Please try again.',
-'mailmypassword'       => 'Mail me a new password',
+'wrongpassword'                => 'Incorrect password entered. Please try again.',
+'wrongpasswordempty'           => 'Password entered was blank. Please try again.',
+'mailmypassword'       => 'Email password',
 'passwordremindertitle' => "Password reminder from {{SITENAME}}",
 'passwordremindertext' => "Someone (probably you, from IP address $1)
 requested that we send you a new {{SITENAME}} login password for {{SERVERNAME}}.
@@ -662,7 +665,8 @@ Please log in again after you receive it.",
 'eauthentsent'             =>  "A confirmation email has been sent to the nominated email address.
 Before any other mail is sent to the account, you will have to follow the instructions in the email,
 to confirm that the account is actually yours.",
-'loginend'                         => '&nbsp;',
+'loginend'                         => '',
+'signupend'                        => '{{int:loginend}}',
 'mailerror'                 => "Error sending mail: $1",
 'acct_creation_throttle_hit' => 'Sorry, you have already created $1 accounts. You can\'t make any more.',
 'emailauthenticated'        => 'Your email address was authenticated on $1.',
index 4ca592a..9a132a2 100644 (file)
@@ -271,6 +271,21 @@ span.subpages {
     color: red;
     font-size: larger;
 }
+.errorbox {
+    font-size: larger;
+    border: 2px solid red;
+    padding: .5em 1em;
+    float: left;
+    margin-bottom: 2em;
+    background-color: #fff2f2;
+}
+.errorbox h2 {
+    font-size: 1em;
+    font-weight: bold;
+    display: inline;
+    margin: 0 .5em 0 0;
+    border: none;
+}
 #catlinks {
     border: 1px solid #aaa;
     background-color: #f9f9f9;
@@ -1050,6 +1065,41 @@ div.prefsectiontip {
     margin-top: 2em;
 }
 
+#userlogin {
+    margin: 0 3em 1em 0;
+    border: 1px solid #aaa;
+    clear: both;
+    padding: 1.5em 2em;
+    background-color: #f9f9f9;
+    float: left;
+}
+
+#userlogin table {
+    background-color: #f9f9f9;
+}
+
+#userlogin h2 {
+    padding-top: 0;
+}
+
+#userloginprompt {
+    font-size: 85%;
+}
+
+#login-emailforlost {
+    font-size: 85%;
+    line-height: 1.2;
+    padding-top: 2em;
+}
+
+#userlogin .loginText, #userlogin .loginPassword {
+    width: 12em;
+}
+
+#userloginlink a, #wpLoginattempt, #wpCreateaccount {
+    font-weight: bold;
+}
+
 /*
 ** IE/Mac fixes, hope to find a validating way to move this
 ** to a separate stylesheet. This would work but doesn't validate:
index 92bbf3e..6050514 100644 (file)
@@ -218,3 +218,7 @@ input#wpSave, input#wpDiff {
        margin-left: 0.33em;
 }
 
+#userlogin {
+    float: right;
+    margin: 0 0 1em 3em;
+}
\ No newline at end of file