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

Change subject: Add centralauth-welcomecreation-msg
......................................................................


Add centralauth-welcomecreation-msg

People want to be able to specify a message to be displayed after
account creation, so add centralauth-welcomecreation-msg to allow them
to do that.

We also allow the CentralAuthPostLoginRedirect hook to override this
message.

Bug: 52373
Change-Id: I69d854cb2262fb6670cb8be40542937745c6e8c4
---
M CentralAuth.i18n.php
M specials/SpecialCentralLogin.php
2 files changed, 29 insertions(+), 5 deletions(-)

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



diff --git a/CentralAuth.i18n.php b/CentralAuth.i18n.php
index 7636001..2dca937 100644
--- a/CentralAuth.i18n.php
+++ b/CentralAuth.i18n.php
@@ -267,6 +267,7 @@
        'centralauth-login-no-others'    => 'You have been automatically logged 
into other projects of {{int:Centralauth-groupname}}.',
        'centralauth-logout-no-others'   => 'You have been automatically logged 
out of other projects of {{int:Centralauth-groupname}}.',
        'centralauth-hidden-blockreason' => 'globally hidden by $1 at $2 with 
following reason: $3',
+       'centralauth-welcomecreation-msg' => '', # do not translate or 
duplicate this message to other languages
 
        // Logging
        'centralauth-log-name'         => 'Global account log',
diff --git a/specials/SpecialCentralLogin.php b/specials/SpecialCentralLogin.php
index 887bf07..20ff18b 100644
--- a/specials/SpecialCentralLogin.php
+++ b/specials/SpecialCentralLogin.php
@@ -196,22 +196,45 @@
                // which is needed or the personal links will be wrong.
                $this->getContext()->setUser( $user );
 
-               // Mark the session to include the edge login imgs on the next 
pageview
-               $request->setSessionData( 'CentralAuthDoEdgeLogin', true );
-
                // Show the login success page
                $form = new LoginForm( new FauxRequest() );
+               $inject_html = '';
+
+               if ( $attempt['type'] === 'signup' ) {
+                       $msg = $this->msg( 'centralauth-welcomecreation-msg' );
+                       if ( !$msg->isDisabled() ) {
+                               $inject_html .= $msg->params( wfEscapeWikiText( 
$user->getName() ) )->parseAsBlock();
+                       }
+               }
 
                // Allow other extensions to modify the returnTo and 
returnToQuery
                wfRunHooks( 'CentralAuthPostLoginRedirect', array(
                        &$attempt['returnTo'],
                        &$attempt['returnToQuery'],
                        $attempt['stickHTTPS'],
-                       $attempt['type']
+                       $attempt['type'],
+                       &$inject_html
                ) );
 
+               if ( $inject_html === '' ) {
+                       $action = 'successredirect';
+
+                       // Mark the session to include the edge login imgs on 
the next pageview
+                       $request->setSessionData( 'CentralAuthDoEdgeLogin', 
true );
+               } else {
+                       $action = 'success';
+
+                       $this->getOutput()->addHTML( $inject_html );
+
+                       // Show HTML to trigger cross-domain cookies.
+                       // This will trigger filling in the "remember me" token 
cookie on the
+                       // central wiki, which can only be done once 
authorization is completed.
+                       $this->getOutput()->addHtml(
+                               CentralAuthHooks::getDomainAutoLoginHtml( 
$user, $centralUser ) );
+               }
+
                $form->showReturnToPage(
-                       'successredirect',
+                       $action,
                        $attempt['returnTo'],
                        $attempt['returnToQuery'],
                        ( $attempt['finalProto'] == 'https' ) // influnces 
http/https of returnTo page

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I69d854cb2262fb6670cb8be40542937745c6e8c4
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: CSteipp <[email protected]>
Gerrit-Reviewer: Deskana <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: Swalling <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to