From 0d1d98431314b1a8374a175165d15f349c55f4b0 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 26 Sep 2009 00:49:32 +0000 Subject: [PATCH] Revert broken rewrite of login system; totally broken. * Login doesn't attach to session properly, so can't stay logged in! * Password field shown in plaintext! If it just DOESN'T WORK please keep it on a work branch, don't put it in trunk! Reverted: r56682 r56683 r56684 r56686 r56688 r56696 r56699 r56702 r56703 r56704 r56782 r56896 --- RELEASE-NOTES | 6 - docs/hooks.txt | 10 +- includes/AuthPlugin.php | 9 +- includes/AutoLoader.php | 5 +- includes/ExternalUser.php | 18 - includes/HTMLForm.php | 522 ++------ includes/Login.php | 596 --------- includes/SpecialPage.php | 4 +- includes/api/ApiLogin.php | 36 +- includes/parser/Parser.php | 32 +- includes/specials/SpecialCreateAccount.php | 524 -------- includes/specials/SpecialResetpass.php | 260 ++-- includes/specials/SpecialUserlogin.php | 1366 ++++++++++++++------ includes/templates/Userlogin.php | 323 +++++ languages/messages/MessagesEn.php | 8 +- languages/messages/MessagesQqq.php | 4 +- maintenance/language/messages.inc | 2 - skins/common/shared.css | 2 - skins/monobook/main.css | 49 + 19 files changed, 1567 insertions(+), 2209 deletions(-) delete mode 100644 includes/Login.php delete mode 100644 includes/specials/SpecialCreateAccount.php create mode 100644 includes/templates/Userlogin.php diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 5acf13d203..f2935ec53a 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -87,11 +87,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN correctly (img_auth only) * $wgUploadMaintenance added to disable file deletions and restorations during maintenance -* UserLoginForm and UserCreateForm hooks, and AuthPlugin::modifyUITemplate, now receive a - SpecialPage subclass instead of a QuickTemplate subclass. Hence there is no - $template->set(), etc. The hook has access to most of the stuff that will go into the - Login/Create form; see the documentation on HTMLForm for syntax for extra fields. - LoginForm class is deprecated, its state constants are now in the Login class. * New hook AbortNewAccountAuto, called before account creation from AuthPlugin- or ExtUser-driven requests. @@ -240,7 +235,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * A new permission, 'root', is created. Analogous to root users on Unix systems, the root permission effectively grants all other permissions on a wiki. Useful for debugging and administration. -* (bug 16979) Tracking categories for __INDEX__ and __NOINDEX__ * New configuration variable $wgShowPageOnRedlink that can be set to show the page instead of an edit interface when visiting a red link. The value can be specified for specific usergroups and namespaces. diff --git a/docs/hooks.txt b/docs/hooks.txt index 4bfa457a17..0ed4b0fb66 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -244,8 +244,8 @@ $block: The block from which the autoblock is coming. 'AbortLogin': Return false to cancel account login. $user: the User object being authenticated against $password: the password being submitted, not yet checked for validity -&$retval: a Login class constant to return from authenticateUserData(); - default is Login::ABORTED. Note that the client may be using +&$retval: a LoginForm class constant to return from authenticateUserData(); + default is LoginForm::ABORTED. Note that the client may be using a machine API rather than the HTML user interface. 'AbortMove': allows to abort moving an article (title) @@ -950,7 +950,7 @@ $code: language code succeeded or failed. No return data is accepted; this hook is for auditing only. $user: the User object being authenticated against $password: the password being submitted and found wanting -$retval: a Login class constant with authenticateUserData() return +$retval: a LoginForm class constant with authenticateUserData() return value (SUCCESS, WRONG_PASS, etc) 'LogLine': Processes a single log entry on Special:Log @@ -1532,7 +1532,7 @@ override the default password checks determine if the password was valid 'UserCreateForm': change to manipulate the login form -$sp: SpecialCreateAccount instance +$template: SimpleTemplate instance for the form 'UserCryptPassword': called when hashing a password, return false to implement your own hashing method @@ -1602,7 +1602,7 @@ $user: the user object that was created on login $inject_html: Any HTML to inject after the "logged in" message. 'UserLoginForm': change to manipulate the login form -$sp: SpecialCreateAccount instance +$template: SimpleTemplate instance for the form 'UserLoginMailPassword': Block users from emailing passwords $name: the username to email the password of. diff --git a/includes/AuthPlugin.php b/includes/AuthPlugin.php index 97cb11f1c0..eacabd4e41 100644 --- a/includes/AuthPlugin.php +++ b/includes/AuthPlugin.php @@ -62,13 +62,12 @@ class AuthPlugin { /** * Modify options in the login template. * - * @param $sp SpecialUserlogin or SpecialCreateAccount object. - * @param $type String 'signup' or 'login'. Redundant because - * you can just use instanceof to tell the two cases apart. + * @param $template UserLoginTemplate object. + * @param $type String 'signup' or 'login'. */ - public function modifyUITemplate( &$sp, $type=null ) { + public function modifyUITemplate( &$template, &$type ) { # Override this! - $sp->mDomains = false; + $template->set( 'usedomain', false ); } /** diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 3f4ecf4cf5..7b7303d17a 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -134,8 +134,6 @@ $wgAutoloadLocalClasses = array( 'LinksUpdate' => 'includes/LinksUpdate.php', 'LocalisationCache' => 'includes/LocalisationCache.php', 'LocalisationCache_BulkLoad' => 'includes/LocalisationCache.php', - 'LoginForm' => 'includes/Login.php', # For B/C - 'Login' => 'includes/Login.php', 'LogPage' => 'includes/LogPage.php', 'LogPager' => 'includes/LogEventsList.php', 'LogEventsList' => 'includes/LogEventsList.php', @@ -495,7 +493,6 @@ $wgAutoloadLocalClasses = array( 'AncientPagesPage' => 'includes/specials/SpecialAncientpages.php', 'BrokenRedirectsPage' => 'includes/specials/SpecialBrokenRedirects.php', 'ContribsPager' => 'includes/specials/SpecialContributions.php', - 'SpecialCreateAccount' => 'includes/specials/SpecialCreateAccount.php', 'DBLockForm' => 'includes/specials/SpecialLockdb.php', 'DBUnlockForm' => 'includes/specials/SpecialUnlockdb.php', 'DeadendPagesPage' => 'includes/specials/SpecialDeadendpages.php', @@ -516,6 +513,7 @@ $wgAutoloadLocalClasses = array( 'ImportStringSource' => 'includes/Import.php', 'LinkSearchPage' => 'includes/specials/SpecialLinkSearch.php', 'ListredirectsPage' => 'includes/specials/SpecialListredirects.php', + 'LoginForm' => 'includes/specials/SpecialUserlogin.php', 'LonelyPagesPage' => 'includes/specials/SpecialLonelypages.php', 'LongPagesPage' => 'includes/specials/SpecialLongpages.php', 'MIMEsearchPage' => 'includes/specials/SpecialMIMEsearch.php', @@ -564,7 +562,6 @@ $wgAutoloadLocalClasses = array( 'UnwatchedpagesPage' => 'includes/specials/SpecialUnwatchedpages.php', 'UploadForm' => 'includes/specials/SpecialUpload.php', 'UploadFormMogile' => 'includes/specials/SpecialUploadMogile.php', - 'SpecialUserLogin' => 'includes/specials/SpecialUserlogin.php', 'UserrightsPage' => 'includes/specials/SpecialUserrights.php', 'UsersPager' => 'includes/specials/SpecialListusers.php', 'WantedCategoriesPage' => 'includes/specials/SpecialWantedcategories.php', diff --git a/includes/ExternalUser.php b/includes/ExternalUser.php index 334ec1799e..a5f932232e 100644 --- a/includes/ExternalUser.php +++ b/includes/ExternalUser.php @@ -285,22 +285,4 @@ abstract class ExternalUser { 'eu_external_id' => $this->getId() ), __METHOD__ ); } - - /** - * Check whether this external user id is already linked with - * a local user. - * @return Mixed User if the account is linked, Null otherwise. - */ - public final function getLocalUser(){ - $dbr = wfGetDb( DB_SLAVE ); - $row = $dbr->selectRow( - 'external_user', - '*', - array( 'eu_external_id' => $this->getId() ) - ); - return $row - ? User::newFromId( $row->eu_wiki_id ) - : null; - } - } diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 50683a4b19..ca5121e519 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -1,54 +1,16 @@ $info, - * where $info is an Associative Array with any of the following: - * - * 'class' -- the subclass of HTMLFormField that will be used - * to create the object. *NOT* the CSS class! - * 'type' -- roughly translates into the + + + + + data['canremember'] ) { ?> + + + + '4', + 'id' => 'wpRemember' + ) + ( $this->data['remember'] ? array( 'checked' ) : array() ) ); ?> + + + + + + + + + 'wpLoginAttempt', + 'tabindex' => '5' + ) ); + if ( $this->data['useemail'] && $this->data['canreset'] ) { + echo ' '; + echo Html::input( 'wpMailmypassword', wfMsg( 'mailmypassword' ), 'submit', array( + 'id' => 'wpMailmypassword', + 'tabindex' => '6' + ) ); + } ?> + + + + +haveData( 'uselang' ) ) { ?> + + +
msgWiki( 'loginend' ); ?>
+data['extraInput'][] = array( + 'name' => $name, + 'value' => $value, + 'type' => $type, + 'msg' => $msg, + 'helptext' => $helptext, + ); + } + + function execute() { + if( $this->data['message'] ) { +?> +
+ data['messagetype'] == 'error' ) { ?> +

msg('loginerror') ?>

+ + html('message') ?> +
+
+ +
+ +
+

msg('createaccount') ?>

+ + html('header'); /* pre-table point for form plugins... */ ?> + haveData( 'languages' ) ) { ?> + + + + + + + + + + data['usedomain'] ) { + $doms = ""; + foreach( $this->data['domainnames'] as $dom ) { + $doms .= ""; + } + ?> + + + + + + + + + + + data['useemail'] ) { ?> + + + + data['userealname'] ) { ?> + + + + + + + data['canremember'] ) { ?> + + + + +data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) { + foreach ( $this->data['extraInput'] as $inputItem ) { ?> + + + + + + + + + +
+ data['name'], 'text', array( + 'class' => 'loginText', + 'id' => 'wpName2', + 'tabindex' => '1', + 'size' => '20', + 'required', + 'autofocus' + ) ); ?> +
+ 'loginPassword', + 'id' => 'wpPassword2', + 'tabindex' => '2', + 'size' => '20' + ) + User::passwordChangeInputAttribs() ); ?> +
msg( 'yourdomainname' ) ?> + +
+ 'loginPassword', + 'id' => 'wpRetype', + 'tabindex' => '4', + 'size' => '20' + ) + User::passwordChangeInputAttribs() ); ?> +
+ data['email'], 'email', array( + 'class' => 'loginText', + 'id' => 'wpEmail', + 'tabindex' => '5', + 'size' => '20' + ) ); ?> +
+ data['emailrequired'] ) { + $this->msgWiki('prefs-help-email-required'); + } else { + $this->msgWiki('prefs-help-email'); + } ?> +
+
+ +
+ msgWiki('prefs-help-realname'); ?> +
+
+ data['remember'] ) { ?>checked="checked" + /> +
+ /> + +
+ msgWiki( $inputItem['helptext'] ); ?> +
+ +
+ + data['createemail'] ) { ?> + + +
+haveData( 'uselang' ) ) { ?> +
+
+
msgWiki( 'signupend' ); ?>
+ '{{PLURAL:$2|This category contains only the following file.|The following {{PLURAL:$1|file is|$1 files are}} in this category, out of $2 total.}}', 'category-file-count-limited' => 'The following {{PLURAL:$1|file is|$1 files are}} in the current category.', 'listingcontinuesabbrev' => 'cont.', -'index-category' => 'Indexed pages', -'noindex-category' => 'Noindexed pages', 'linkprefix' => '/^(.*?)([a-zA-Z\\x80-\\xff]+)$/sD', # only translate this message to other languages if you have to change it 'mainpagetext' => "'''MediaWiki has been successfully installed.'''", @@ -1044,14 +1042,14 @@ Do not forget to change your [[Special:Preferences|{{SITENAME}} preferences]].', 'login' => 'Log in', 'nav-login-createaccount' => 'Log in / create account', 'loginprompt' => 'You must have cookies enabled to log in to {{SITENAME}}.', -'userlogin' => 'Log in', +'userlogin' => 'Log in / create account', 'logout' => 'Log out', 'userlogout' => 'Log out', 'notloggedin' => 'Not logged in', -'nologin' => "Don't have an account? '''$1'''.", +'nologin' => "Don't have an account? $1.", 'nologinlink' => 'Create an account', 'createaccount' => 'Create account', -'gotaccount' => "Already have an account? '''$1'''.", +'gotaccount' => 'Already have an account? $1.', 'gotaccountlink' => 'Log in', 'createaccountmail' => 'by e-mail', 'badretype' => 'The passwords you entered do not match.', diff --git a/languages/messages/MessagesQqq.php b/languages/messages/MessagesQqq.php index 04081a85e6..b9aebaca48 100644 --- a/languages/messages/MessagesQqq.php +++ b/languages/messages/MessagesQqq.php @@ -236,8 +236,6 @@ This is the toolbar: [[Image:Toolbar.png]]", * $1: number of files shown', 'listingcontinuesabbrev' => 'Shown in contiuation of each first letter group. See http://test.wikipedia.org/wiki/Category:Test_ko?uselang={{SUBPAGENAME}}, for example.', -'index-category' => 'Name of the category where pages with the __INDEX__ behaviour switch are listed', -'noindex-category' => 'Name of the category where pages with the __NOINDEX__ behaviour switch are listed', 'linkprefix' => '{{optional}}', 'mainpagetext' => 'Along with {{msg|mainpagedocfooter}}, the text you will see on the Main Page when your wiki is installed.', @@ -598,7 +596,7 @@ HTML markup cannot be used.", {{Identical|Log in}}", 'nav-login-createaccount' => "Shown to anonymous users in the upper right corner of the page. When you can't create an account, the message {{msg|login}} is shown.", 'loginprompt' => 'A small notice in the log in form.', -'userlogin' => 'Name of special page [[Special:UserLogin]] where a user can log in.', +'userlogin' => 'Name of special page [[Special:UserLogin]] where a user can log in or click to create a user account.', 'logout' => '{{Identical|Log out}}', 'userlogout' => '{{Identical|Log out}}', 'notloggedin' => 'This message is displayed in the standard skin when not logged in. The message is placed above the login link in the top right corner of pages. diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 13aca82bd7..86aa8d4a33 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -141,8 +141,6 @@ $wgMessageStructure = array( 'category-file-count', 'category-file-count-limited', 'listingcontinuesabbrev', - 'index-category', - 'noindex-category', ), 'mainpage' => array( 'linkprefix', diff --git a/skins/common/shared.css b/skins/common/shared.css index b7acae953b..8f46c5c1a7 100644 --- a/skins/common/shared.css +++ b/skins/common/shared.css @@ -802,5 +802,3 @@ td.mw-enhanced-rc { position: relative; top: -16px; } - -#wpLoginAttempt, #wpCreateaccount { margin-right:0; } diff --git a/skins/monobook/main.css b/skins/monobook/main.css index e7f2009abb..727355bb77 100644 --- a/skins/monobook/main.css +++ b/skins/monobook/main.css @@ -1015,10 +1015,59 @@ td.htmlform-tip { margin-top: 2em; } +div#userloginForm form, +div#userlogin form#userlogin2 { + margin: 0 3em 1em 0; + border: 1px solid #aaa; + clear: both; + padding: 1.5em 2em; + background-color: #f9f9f9; + float: left; +} +.rtl div#userloginForm form, +.rtl div#userlogin form#userlogin2 { + float: right; +} + +div#userloginForm table, +div#userlogin form#userlogin2 table { + background-color: #f9f9f9; +} + +div#userloginForm h2, +div#userlogin form#userlogin2 h2 { + padding-top: 0; +} + +div#userlogin .captcha, +div#userloginForm .captcha { + border: 1px solid #bbb; + padding: 1.5em 2em; + background-color: white; +} + +#loginend, #signupend { + clear: both; +} + #userloginprompt, #languagelinks { font-size: 85%; } +#login-sectiontip { + 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: -- 2.20.1