jenkins-bot has submitted this change and it was merged.

Change subject: LoginSignupSpecialPage: Reduce hackiness of "You are already 
logged in" warning
......................................................................


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
---
M includes/specialpage/LoginSignupSpecialPage.php
1 file changed, 8 insertions(+), 7 deletions(-)

Approvals:
  Florianschmidtwelzow: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specialpage/LoginSignupSpecialPage.php 
b/includes/specialpage/LoginSignupSpecialPage.php
index 9e93970..e83c5cf 100644
--- a/includes/specialpage/LoginSignupSpecialPage.php
+++ b/includes/specialpage/LoginSignupSpecialPage.php
@@ -494,12 +494,20 @@
 
                $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 ) );
@@ -620,13 +628,6 @@
                $form->setName( 'userlogin' . ( $this->isSignup() ? '2' : '' ) 
);
                if ( $this->isSignup() ) {
                        $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();

-- 
To view, visit https://gerrit.wikimedia.org/r/311231
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I80dd9dfcd546a50479ebe07b267105cfd4677fc7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to