r86960 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86959‎ | r86960 | r86961 >
Date:18:07, 26 April 2011
Author:nimishg
Status:ok (Comments)
Tags:
Comment:
mft r86011
Modified paths:
  • /branches/wmf/1.17wmf1/includes/specials/SpecialUserlogin.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/includes/specials/SpecialUserlogin.php
@@ -22,24 +22,11 @@
2323 */
2424
2525 /**
26 - * Constructor
27 - */
28 -function wfSpecialUserlogin( $par = '' ) {
29 - global $wgRequest;
30 - if( session_id() == '' ) {
31 - wfSetupSession();
32 - }
33 -
34 - $form = new LoginForm( $wgRequest, $par );
35 - $form->execute();
36 -}
37 -
38 -/**
3926 * Implements Special:UserLogin
4027 *
4128 * @ingroup SpecialPage
4229 */
43 -class LoginForm {
 30+class LoginForm extends SpecialPage {
4431
4532 const SUCCESS = 0;
4633 const NO_NAME = 1;
@@ -56,23 +43,42 @@
5744 const NEED_TOKEN = 12;
5845 const WRONG_TOKEN = 13;
5946
60 - var $mName, $mPassword, $mRetype, $mReturnTo, $mCookieCheck, $mPosted;
61 - var $mAction, $mCreateaccount, $mCreateaccountMail, $mMailmypassword;
 47+ var $mUsername, $mPassword, $mRetype, $mReturnTo, $mCookieCheck, $mPosted;
 48+ var $mAction, $mCreateaccount, $mCreateaccountMail;
6249 var $mLoginattempt, $mRemember, $mEmail, $mDomain, $mLanguage;
6350 var $mSkipCookieCheck, $mReturnToQuery, $mToken, $mStickHTTPS;
 51+ var $mType, $mReason, $mRealName;
 52+ var $mAbortLoginErrorMsg = 'login-abort-generic';
6453
 54+ /**
 55+ * @var ExternalUser
 56+ */
6557 private $mExtUser = null;
6658
6759 /**
68 - * Constructor
69 - * @param $request WebRequest: a WebRequest object passed by reference
70 - * @param $par String: subpage parameter
 60+ * @param WebRequest $request
7161 */
72 - function __construct( &$request, $par = '' ) {
 62+ public function __construct( $request = null ) {
 63+ parent::__construct( 'Userlogin' );
 64+
 65+ if ( $request === null ) {
 66+ global $wgRequest;
 67+ $this->load( $wgRequest );
 68+ } else {
 69+ $this->load( $request );
 70+ }
 71+ }
 72+
 73+ /**
 74+ * Loader
 75+ *
 76+ * @param $request WebRequest object
 77+ */
 78+ function load( $request ) {
7379 global $wgAuth, $wgHiddenPrefs, $wgEnableEmail, $wgRedirectOnLogin;
7480
75 - $this->mType = ( $par == 'signup' ) ? $par : $request->getText( 'type' ); # Check for [[Special:Userlogin/signup]]
76 - $this->mName = $request->getText( 'wpName' );
 81+ $this->mType = $request->getText( 'type' );
 82+ $this->mUsername = $request->getText( 'wpName' );
7783 $this->mPassword = $request->getText( 'wpPassword' );
7884 $this->mRetype = $request->getText( 'wpRetype' );
7985 $this->mDomain = $request->getText( 'wpDomain' );
@@ -83,9 +89,7 @@
8490 $this->mPosted = $request->wasPosted();
8591 $this->mCreateaccount = $request->getCheck( 'wpCreateaccount' );
8692 $this->mCreateaccountMail = $request->getCheck( 'wpCreateaccountMail' )
87 - && $wgEnableEmail;
88 - $this->mMailmypassword = $request->getCheck( 'wpMailmypassword' )
89 - && $wgEnableEmail;
 93+ && $wgEnableEmail;
9094 $this->mLoginattempt = $request->getCheck( 'wpLoginattempt' );
9195 $this->mAction = $request->getVal( 'action' );
9296 $this->mRemember = $request->getCheck( 'wpRemember' );
@@ -105,9 +109,9 @@
106110 $this->mEmail = '';
107111 }
108112 if( !in_array( 'realname', $wgHiddenPrefs ) ) {
109 - $this->mRealName = $request->getText( 'wpRealName' );
 113+ $this->mRealName = $request->getText( 'wpRealName' );
110114 } else {
111 - $this->mRealName = '';
 115+ $this->mRealName = '';
112116 }
113117
114118 if( !$wgAuth->validDomain( $this->mDomain ) ) {
@@ -123,7 +127,15 @@
124128 }
125129 }
126130
127 - function execute() {
 131+ public function execute( $par ) {
 132+ if ( session_id() == '' ) {
 133+ wfSetupSession();
 134+ }
 135+
 136+ if ( $par == 'signup' ) { # Check for [[Special:Userlogin/signup]]
 137+ $this->mType = 'signup';
 138+ }
 139+
128140 if ( !is_null( $this->mCookieCheck ) ) {
129141 $this->onCookieRedirectCheck( $this->mCookieCheck );
130142 return;
@@ -132,8 +144,6 @@
133145 return $this->addNewAccount();
134146 } elseif ( $this->mCreateaccountMail ) {
135147 return $this->addNewAccountMailPassword();
136 - } elseif ( $this->mMailmypassword ) {
137 - return $this->mailPassword();
138148 } elseif ( ( 'submitlogin' == $this->mAction ) || $this->mLoginattempt ) {
139149 return $this->processLogin();
140150 }
@@ -148,7 +158,7 @@
149159 global $wgOut;
150160
151161 if ( $this->mEmail == '' ) {
152 - $this->mainLoginForm( wfMsgExt( 'noemail', array( 'parsemag', 'escape' ), $this->mName ) );
 162+ $this->mainLoginForm( wfMsgExt( 'noemail', array( 'parsemag', 'escape' ), $this->mUsername ) );
153163 return;
154164 }
155165
@@ -167,8 +177,6 @@
168178 $u->addNewUserLogEntry( true, $this->mReason );
169179
170180 $wgOut->setPageTitle( wfMsg( 'accmailtitle' ) );
171 - $wgOut->setRobotPolicy( 'noindex,nofollow' );
172 - $wgOut->setArticleRelated( false );
173181
174182 if( !$result->isGood() ) {
175183 $this->mainLoginForm( wfMsg( 'mailerror', $result->getWikiText() ) );
@@ -227,9 +235,7 @@
228236 # Confirm that the account was created
229237 $self = SpecialPage::getTitleFor( 'Userlogin' );
230238 $wgOut->setPageTitle( wfMsgHtml( 'accountcreated' ) );
231 - $wgOut->setArticleRelated( false );
232 - $wgOut->setRobotPolicy( 'noindex,nofollow' );
233 - $wgOut->addHTML( wfMsgWikiHtml( 'accountcreatedtext', $u->getName() ) );
 239+ $wgOut->addWikiMsg( 'accountcreatedtext', $u->getName() );
234240 $wgOut->returnToMain( false, $self );
235241 wfRunHooks( 'AddNewAccount', array( $u, false ) );
236242 $u->addNewUserLogEntry( false, $this->mReason );
@@ -258,7 +264,8 @@
259265 // create a local account and login as any domain user). We only need
260266 // to check this for domains that aren't local.
261267 if( 'local' != $this->mDomain && $this->mDomain != '' ) {
262 - if( !$wgAuth->canCreateAccounts() && ( !$wgAuth->userExists( $this->mName ) || !$wgAuth->authenticate( $this->mName, $this->mPassword ) ) ) {
 268+ if( !$wgAuth->canCreateAccounts() && ( !$wgAuth->userExists( $this->mUsername )
 269+ || !$wgAuth->authenticate( $this->mUsername, $this->mPassword ) ) ) {
263270 $this->mainLoginForm( wfMsg( 'wrongpassword' ) );
264271 return false;
265272 }
@@ -272,7 +279,7 @@
273280 # Request forgery checks.
274281 if ( !self::getCreateaccountToken() ) {
275282 self::setCreateaccountToken();
276 - $this->mainLoginForm( wfMsgExt( 'nocookiesnew', array( 'parseinline' ) ) );
 283+ $this->mainLoginForm( wfMsgExt( 'nocookiesfornew', array( 'parseinline' ) ) );
277284 return false;
278285 }
279286
@@ -293,7 +300,7 @@
294301 $wgOut->permissionRequired( 'createaccount' );
295302 return false;
296303 } elseif ( $wgUser->isBlockedFromCreateAccount() ) {
297 - $this->userBlockedMessage();
 304+ $this->userBlockedMessage( $wgUser->isBlockedFromCreateAccount() );
298305 return false;
299306 }
300307
@@ -304,7 +311,7 @@
305312 }
306313
307314 # Now create a dummy user ($u) and check if it is valid
308 - $name = trim( $this->mName );
 315+ $name = trim( $this->mUsername );
309316 $u = User::newFromName( $name, 'creatable' );
310317 if ( !is_object( $u ) ) {
311318 $this->mainLoginForm( wfMsg( 'noname' ) );
@@ -325,7 +332,14 @@
326333 $valid = $u->getPasswordValidity( $this->mPassword );
327334 if ( $valid !== true ) {
328335 if ( !$this->mCreateaccountMail ) {
329 - $this->mainLoginForm( wfMsgExt( $valid, array( 'parsemag' ), $wgMinimalPasswordLength ) );
 336+ if ( is_array( $valid ) ) {
 337+ $message = array_shift( $valid );
 338+ $params = $valid;
 339+ } else {
 340+ $message = $valid;
 341+ $params = array( $wgMinimalPasswordLength );
 342+ }
 343+ $this->mainLoginForm( wfMsgExt( $message, array( 'parsemag' ), $params ) );
330344 return false;
331345 } else {
332346 # do not force a password for account creation by email
@@ -433,7 +447,7 @@
434448 public function authenticateUserData() {
435449 global $wgUser, $wgAuth, $wgMemc;
436450
437 - if ( $this->mName == '' ) {
 451+ if ( $this->mUsername == '' ) {
438452 return self::NO_NAME;
439453 }
440454
@@ -456,7 +470,7 @@
457471
458472 $throttleCount = 0;
459473 if ( is_array( $wgPasswordAttemptThrottle ) ) {
460 - $throttleKey = wfMemcKey( 'password-throttle', wfGetIP(), md5( $this->mName ) );
 474+ $throttleKey = wfMemcKey( 'password-throttle', wfGetIP(), md5( $this->mUsername ) );
461475 $count = $wgPasswordAttemptThrottle['count'];
462476 $period = $wgPasswordAttemptThrottle['seconds'];
463477
@@ -481,16 +495,16 @@
482496 // creates the user in the database. Until we load $wgUser, checking
483497 // for user existence using User::newFromName($name)->getId() below
484498 // will effectively be using stale data.
485 - if ( $wgUser->getName() === $this->mName ) {
486 - wfDebug( __METHOD__ . ": already logged in as {$this->mName}\n" );
 499+ if ( $wgUser->getName() === $this->mUsername ) {
 500+ wfDebug( __METHOD__ . ": already logged in as {$this->mUsername}\n" );
487501 return self::SUCCESS;
488502 }
489503
490 - $this->mExtUser = ExternalUser::newFromName( $this->mName );
 504+ $this->mExtUser = ExternalUser::newFromName( $this->mUsername );
491505
492506 # TODO: Allow some magic here for invalid external names, e.g., let the
493507 # user choose a different wiki name.
494 - $u = User::newFromName( $this->mName );
 508+ $u = User::newFromName( $this->mUsername );
495509 if( !( $u instanceof User ) || !User::isUsableName( $u->getName() ) ) {
496510 return self::ILLEGAL;
497511 }
@@ -518,7 +532,7 @@
519533
520534 // Give general extensions, such as a captcha, a chance to abort logins
521535 $abort = self::ABORTED;
522 - if( !wfRunHooks( 'AbortLogin', array( $u, $this->mPassword, &$abort ) ) ) {
 536+ if( !wfRunHooks( 'AbortLogin', array( $u, $this->mPassword, &$abort, &$this->mAbortLoginErrorMsg ) ) ) {
523537 return $abort;
524538 }
525539
@@ -579,6 +593,9 @@
580594 /**
581595 * Attempt to automatically create a user on login. Only succeeds if there
582596 * is an external authentication method which allows it.
 597+ *
 598+ * @param $user User
 599+ *
583600 * @return integer Status code
584601 */
585602 function attemptAutoCreate( $user ) {
@@ -618,6 +635,14 @@
619636 }
620637 }
621638
 639+ $abortError = '';
 640+ if( !wfRunHooks( 'AbortAutoAccount', array( $user, &$abortError ) ) ) {
 641+ // Hook point to add extra creation throttles and blocks
 642+ wfDebug( "LoginForm::attemptAutoCreate: a hook blocked creation: $abortError\n" );
 643+ $this->mAbortLoginErrorMsg = $abortError;
 644+ return self::ABORTED;
 645+ }
 646+
622647 wfDebug( __METHOD__ . ": creating account\n" );
623648 $this->initUser( $user, true );
624649 return self::SUCCESS;
@@ -639,7 +664,7 @@
640665 self::clearLoginToken();
641666
642667 // Reset the throttle
643 - $key = wfMemcKey( 'password-throttle', wfGetIP(), md5( $this->mName ) );
 668+ $key = wfMemcKey( 'password-throttle', wfGetIP(), md5( $this->mUsername ) );
644669 global $wgMemc;
645670 $wgMemc->delete( $key );
646671
@@ -657,7 +682,7 @@
658683 break;
659684
660685 case self::NEED_TOKEN:
661 - $this->mainLoginForm( wfMsgExt( 'nocookieslogin', array( 'parseinline' ) ) );
 686+ $this->mainLoginForm( wfMsgExt( 'nocookiesforlogin', array( 'parseinline' ) ) );
662687 break;
663688 case self::WRONG_TOKEN:
664689 $this->mainLoginForm( wfMsg( 'sessionfailure' ) );
@@ -671,9 +696,9 @@
672697 break;
673698 case self::NOT_EXISTS:
674699 if( $wgUser->isAllowed( 'createaccount' ) ) {
675 - $this->mainLoginForm( wfMsgWikiHtml( 'nosuchuser', htmlspecialchars( $this->mName ) ) );
 700+ $this->mainLoginForm( wfMsgExt( 'nosuchuser', 'parseinline', $this->mUsername ) );
676701 } else {
677 - $this->mainLoginForm( wfMsg( 'nosuchusershort', htmlspecialchars( $this->mName ) ) );
 702+ $this->mainLoginForm( wfMsg( 'nosuchusershort', htmlspecialchars( $this->mUsername ) ) );
678703 }
679704 break;
680705 case self::WRONG_PASS:
@@ -693,8 +718,11 @@
694719 break;
695720 case self::USER_BLOCKED:
696721 $this->mainLoginForm( wfMsgExt( 'login-userblocked',
697 - array( 'parsemag', 'escape' ), $this->mName ) );
 722+ array( 'parsemag', 'escape' ), $this->mUsername ) );
698723 break;
 724+ case self::ABORTED:
 725+ $this->mainLoginForm( wfMsg( $this->mAbortLoginErrorMsg ) );
 726+ break;
699727 default:
700728 throw new MWException( 'Unhandled case value' );
701729 }
@@ -703,100 +731,11 @@
704732 function resetLoginForm( $error ) {
705733 global $wgOut;
706734 $wgOut->addHTML( Xml::element('p', array( 'class' => 'error' ), $error ) );
707 - $reset = new SpecialResetpass();
 735+ $reset = new SpecialChangePassword();
708736 $reset->execute( null );
709737 }
710738
711739 /**
712 - * @private
713 - */
714 - function mailPassword() {
715 - global $wgUser, $wgOut, $wgAuth;
716 -
717 - if ( wfReadOnly() ) {
718 - $wgOut->readOnlyPage();
719 - return false;
720 - }
721 -
722 - if( !$wgAuth->allowPasswordChange() ) {
723 - $this->mainLoginForm( wfMsg( 'resetpass_forbidden' ) );
724 - return;
725 - }
726 -
727 - # Check against blocked IPs so blocked users can't flood admins
728 - # with password resets
729 - if( $wgUser->isBlocked() ) {
730 - $this->mainLoginForm( wfMsg( 'blocked-mailpassword' ) );
731 - return;
732 - }
733 -
734 - # Check for hooks
735 - $error = null;
736 - if ( !wfRunHooks( 'UserLoginMailPassword', array( $this->mName, &$error ) ) ) {
737 - $this->mainLoginForm( $error );
738 - return;
739 - }
740 -
741 - # If the user doesn't have a login token yet, set one.
742 - if ( !self::getLoginToken() ) {
743 - self::setLoginToken();
744 - $this->mainLoginForm( wfMsg( 'sessionfailure' ) );
745 - return;
746 - }
747 -
748 - # If the user didn't pass a login token, tell them we need one
749 - if ( !$this->mToken ) {
750 - $this->mainLoginForm( wfMsg( 'sessionfailure' ) );
751 - return;
752 - }
753 -
754 - # Check against the rate limiter
755 - if( $wgUser->pingLimiter( 'mailpassword' ) ) {
756 - $wgOut->rateLimited();
757 - return;
758 - }
759 -
760 - if ( $this->mName == '' ) {
761 - $this->mainLoginForm( wfMsg( 'noname' ) );
762 - return;
763 - }
764 - $u = User::newFromName( $this->mName );
765 - if( !$u instanceof User ) {
766 - $this->mainLoginForm( wfMsg( 'noname' ) );
767 - return;
768 - }
769 - if ( 0 == $u->getID() ) {
770 - $this->mainLoginForm( wfMsgWikiHtml( 'nosuchuser', htmlspecialchars( $u->getName() ) ) );
771 - return;
772 - }
773 -
774 - # Validate the login token
775 - if ( $this->mToken !== self::getLoginToken() ) {
776 - $this->mainLoginForm( wfMsg( 'sessionfailure' ) );
777 - return;
778 - }
779 -
780 - # Check against password throttle
781 - if ( $u->isPasswordReminderThrottled() ) {
782 - global $wgPasswordReminderResendTime;
783 - # Round the time in hours to 3 d.p., in case someone is specifying
784 - # minutes or seconds.
785 - $this->mainLoginForm( wfMsgExt( 'throttled-mailpassword', array( 'parsemag' ),
786 - round( $wgPasswordReminderResendTime, 3 ) ) );
787 - return;
788 - }
789 -
790 - $result = $this->mailPasswordInternal( $u, true, 'passwordremindertitle', 'passwordremindertext' );
791 - if( $result->isGood() ) {
792 - $this->mainLoginForm( wfMsg( 'passwordsent', $u->getName() ), 'success' );
793 - self::clearLoginToken();
794 - } else {
795 - $this->mainLoginForm( $result->getWikiText( 'mailerror' ) );
796 - }
797 - }
798 -
799 -
800 - /**
801740 * @param $u User object
802741 * @param $throttle Boolean
803742 * @param $emailTitle String: message name of email title
@@ -872,9 +811,14 @@
873812 global $wgUser;
874813 # Run any hooks; display injected HTML
875814 $injected_html = '';
 815+ $welcome_creation_msg = 'welcomecreation';
 816+
876817 wfRunHooks( 'UserLoginComplete', array( &$wgUser, &$injected_html ) );
877 -
878 - $this->displaySuccessfulLogin( 'welcomecreation', $injected_html );
 818+
 819+ //let any extensions change what message is shown
 820+ wfRunHooks( 'BeforeWelcomeCreation', array( &$welcome_creation_msg, &$injected_html ) );
 821+
 822+ $this->displaySuccessfulLogin( $welcome_creation_msg, $injected_html );
879823 }
880824
881825 /**
@@ -884,9 +828,10 @@
885829 global $wgOut, $wgUser;
886830
887831 $wgOut->setPageTitle( wfMsg( 'loginsuccesstitle' ) );
888 - $wgOut->setRobotPolicy( 'noindex,nofollow' );
889 - $wgOut->setArticleRelated( false );
890 - $wgOut->addWikiMsg( $msgname, $wgUser->getName() );
 832+ if( $msgname ){
 833+ $wgOut->addWikiMsg( $msgname, $wgUser->getName() );
 834+ }
 835+
891836 $wgOut->addHTML( $injected_html );
892837
893838 if ( !empty( $this->mReturnTo ) ) {
@@ -896,9 +841,15 @@
897842 }
898843 }
899844
900 - /** */
901 - function userBlockedMessage() {
902 - global $wgOut, $wgUser;
 845+ /**
 846+ * Output a message that informs the user that they cannot create an account because
 847+ * there is a block on them or their IP which prevents account creation. Note that
 848+ * User::isBlockedFromCreateAccount(), which gets this block, ignores the 'hardblock'
 849+ * setting on blocks (bug 13611).
 850+ * @param $block Block the block causing this error
 851+ */
 852+ function userBlockedMessage( Block $block ) {
 853+ global $wgOut;
903854
904855 # Let's be nice about this, it's likely that this feature will be used
905856 # for blocking large numbers of innocent people, e.g. range blocks on
@@ -909,17 +860,19 @@
910861 # out.
911862
912863 $wgOut->setPageTitle( wfMsg( 'cantcreateaccounttitle' ) );
913 - $wgOut->setRobotPolicy( 'noindex,nofollow' );
914 - $wgOut->setArticleRelated( false );
915864
916 - $ip = wfGetIP();
917 - $blocker = User::whoIs( $wgUser->mBlock->mBy );
918 - $block_reason = $wgUser->mBlock->mReason;
919 -
 865+ $block_reason = $block->mReason;
920866 if ( strval( $block_reason ) === '' ) {
921867 $block_reason = wfMsg( 'blockednoreason' );
922868 }
923 - $wgOut->addWikiMsg( 'cantcreateaccount-text', $ip, $block_reason, $blocker );
 869+
 870+ $wgOut->addWikiMsg(
 871+ 'cantcreateaccount-text',
 872+ $block->getTarget(),
 873+ $block_reason,
 874+ $block->getBlocker()->getName()
 875+ );
 876+
924877 $wgOut->returnToMain( false );
925878 }
926879
@@ -927,10 +880,11 @@
928881 * @private
929882 */
930883 function mainLoginForm( $msg, $msgtype = 'error' ) {
931 - global $wgUser, $wgOut, $wgHiddenPrefs, $wgEnableEmail;
 884+ global $wgUser, $wgOut, $wgHiddenPrefs;
 885+ global $wgEnableEmail, $wgEnableUserEmail;
932886 global $wgRequest, $wgLoginLanguageSelector;
933887 global $wgAuth, $wgEmailConfirmToEdit, $wgCookieExpiration;
934 - global $wgSecureLogin;
 888+ global $wgSecureLogin, $wgPasswordResetRoutes;
935889
936890 $titleObj = SpecialPage::getTitleFor( 'Userlogin' );
937891
@@ -942,7 +896,7 @@
943897 $wgOut->readOnlyPage();
944898 return;
945899 } elseif ( $wgUser->isBlockedFromCreateAccount() ) {
946 - $this->userBlockedMessage();
 900+ $this->userBlockedMessage( $wgUser->isBlockedFromCreateAccount() );
947901 return;
948902 } elseif ( count( $permErrors = $titleObj->getUserPermissionsErrors( 'createaccount', $wgUser, true ) )>0 ) {
949903 $wgOut->showPermissionsErrorPage( $permErrors, 'createaccount' );
@@ -950,11 +904,11 @@
951905 }
952906 }
953907
954 - if ( $this->mName == '' ) {
 908+ if ( $this->mUsername == '' ) {
955909 if ( $wgUser->isLoggedIn() ) {
956 - $this->mName = $wgUser->getName();
 910+ $this->mUsername = $wgUser->getName();
957911 } else {
958 - $this->mName = $wgRequest->getCookie( 'UserName' );
 912+ $this->mUsername = $wgRequest->getCookie( 'UserName' );
959913 }
960914 }
961915
@@ -996,8 +950,12 @@
997951 $template->set( 'link', '' );
998952 }
999953
 954+ $resetLink = $this->mType == 'signup'
 955+ ? null
 956+ : is_array( $wgPasswordResetRoutes ) && in_array( true, array_values( $wgPasswordResetRoutes ) );
 957+
1000958 $template->set( 'header', '' );
1001 - $template->set( 'name', $this->mName );
 959+ $template->set( 'name', $this->mUsername );
1002960 $template->set( 'password', $this->mPassword );
1003961 $template->set( 'retype', $this->mRetype );
1004962 $template->set( 'email', $this->mEmail );
@@ -1012,7 +970,9 @@
1013971 $template->set( 'userealname', !in_array( 'realname', $wgHiddenPrefs ) );
1014972 $template->set( 'useemail', $wgEnableEmail );
1015973 $template->set( 'emailrequired', $wgEmailConfirmToEdit );
 974+ $template->set( 'emailothers', $wgEnableUserEmail );
1016975 $template->set( 'canreset', $wgAuth->allowPasswordChange() );
 976+ $template->set( 'resetlink', $resetLink );
1017977 $template->set( 'canremember', ( $wgCookieExpiration > 0 ) );
1018978 $template->set( 'usereason', $wgUser->isLoggedIn() );
1019979 $template->set( 'remember', $wgUser->getOption( 'rememberpassword' ) || $this->mRemember );
@@ -1053,22 +1013,24 @@
10541014 $wgOut->setPageTitle( wfMsg( 'userloginnocreate' ) );
10551015 }
10561016
1057 - $wgOut->setRobotPolicy( 'noindex,nofollow' );
1058 - $wgOut->setArticleRelated( false );
10591017 $wgOut->disallowUserJs(); // just in case...
10601018 $wgOut->addTemplate( $template );
10611019 }
10621020
10631021 /**
10641022 * @private
 1023+ *
 1024+ * @param $user User
 1025+ *
 1026+ * @return Boolean
10651027 */
10661028 function showCreateOrLoginLink( &$user ) {
10671029 if( $this->mType == 'signup' ) {
1068 - return( true );
 1030+ return true;
10691031 } elseif( $user->isAllowed( 'createaccount' ) ) {
1070 - return( true );
 1032+ return true;
10711033 } else {
1072 - return( false );
 1034+ return false;
10731035 }
10741036 }
10751037
@@ -1186,9 +1148,9 @@
11871149 function makeLanguageSelector() {
11881150 global $wgLang;
11891151
1190 - $msg = wfMsgForContent( 'loginlanguagelinks' );
1191 - if( $msg != '' && !wfEmptyMsg( 'loginlanguagelinks', $msg ) ) {
1192 - $langs = explode( "\n", $msg );
 1152+ $msg = wfMessage( 'loginlanguagelinks' )->inContentLanguage();
 1153+ if( !$msg->isBlank() ) {
 1154+ $langs = explode( "\n", $msg->text() );
11931155 $links = array();
11941156 foreach( $langs as $lang ) {
11951157 $lang = trim( $lang, '* ' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r86972mft r86011, for real this timenimishg19:13, 26 April 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86011Created BeforeWelcomeCreation hook to be run before any welcome message gets ...nimishg23:47, 13 April 2011

Comments

#Comment by Catrope (talk | contribs)   18:20, 26 April 2011

There are a LOT of changes in this rev that weren't in r86011, was that intended?

#Comment by Nimish Gautam (talk | contribs)   19:14, 26 April 2011

oops, you're correct, I rolled back and merged just what I needed to in r86972

Status & tagging log