From: Bartosz DziewoƄski Date: Sat, 17 Sep 2016 14:24:34 +0000 (+0200) Subject: LoginSignupSpecialPage: Reduce hackiness of "You are already logged in" warning X-Git-Tag: 1.31.0-rc.0~5509^2 X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_del%27%2C%20idvote=vote.voteid%29%20%7D%7D?a=commitdiff_plain;h=afeef98df2dc63487a1fef9f124a8d1dfc7cdef5;p=lhc%2Fweb%2Fwiklou.git LoginSignupSpecialPage: Reduce hackiness of "You are already logged in" warning Use HTMLForm's built-in error/warning handling, rather than generate the HTML ourselves. Depends on I9a27911613e62b5c4cb86bea40696cb37c4f49c2. Change-Id: I80dd9dfcd546a50479ebe07b267105cfd4677fc7 --- diff --git a/includes/specialpage/LoginSignupSpecialPage.php b/includes/specialpage/LoginSignupSpecialPage.php index 9e9397017c..e83c5cf5c6 100644 --- a/includes/specialpage/LoginSignupSpecialPage.php +++ b/includes/specialpage/LoginSignupSpecialPage.php @@ -494,12 +494,20 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage { $form = $this->getAuthForm( $requests, $this->authAction, $msg, $msgtype ); $form->prepareForm(); + $submitStatus = Status::newGood(); if ( $msg && $msgtype === 'warning' ) { $submitStatus->warning( $msg ); } elseif ( $msg && $msgtype === 'error' ) { $submitStatus->fatal( $msg ); } + + // warning header for non-standard workflows (e.g. security reauthentication) + if ( !$this->isSignup() && $this->getUser()->isLoggedIn() ) { + $reauthMessage = $this->securityLevel ? 'userlogin-reauth' : 'userlogin-loggedin'; + $submitStatus->warning( $reauthMessage, $this->getUser()->getName() ); + } + $formHtml = $form->getHTML( $submitStatus ); $out->addHTML( $this->getPageHtml( $formHtml ) ); @@ -622,13 +630,6 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage { $form->setId( 'userlogin2' ); } - // warning header for non-standard workflows (e.g. security reauthentication) - if ( !$this->isSignup() && $this->getUser()->isLoggedIn() ) { - $reauthMessage = $this->securityLevel ? 'userlogin-reauth' : 'userlogin-loggedin'; - $form->addHeaderText( Html::rawElement( 'div', [ 'class' => 'warningbox' ], - $this->msg( $reauthMessage )->params( $this->getUser()->getName() )->parse() ) ); - } - $form->suppressDefaultSubmit(); $this->authForm = $form;