Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
SpecialAuthenticationPopupSuccess
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 2
20
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 execute
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2/**
3 * Implements Special:AuthenticationPopupSuccess
4 *
5 * @license GPL-2.0-or-later
6 * @file
7 * @ingroup SpecialPage
8 */
9
10namespace MediaWiki\Specials;
11
12use MediaWiki\Skin\SkinFactory;
13use MediaWiki\SpecialPage\UnlistedSpecialPage;
14
15/**
16 * A page for the 'mediawiki.authenticationPopup' module. If opened in a popup window,
17 * it communicates with the module on the parent page and closes itself.
18 *
19 * @ingroup SpecialPage
20 */
21class SpecialAuthenticationPopupSuccess extends UnlistedSpecialPage {
22    public function __construct(
23        private readonly SkinFactory $skinFactory
24    ) {
25        parent::__construct( 'AuthenticationPopupSuccess' );
26    }
27
28    /** @inheritDoc */
29    public function execute( $par ) {
30        if ( $this->getRequest()->getRawVal( 'display' ) === 'popup' ) {
31            // Replace the default skin with a "micro-skin" that omits most of the interface. (T362706)
32            // In the future, we might allow normal skins to serve this mode too, if they advise that
33            // they support it by setting a skin option, so that colors and fonts could stay consistent.
34            $this->getContext()->setSkin( $this->skinFactory->makeSkin( 'authentication-popup' ) );
35        }
36
37        $this->setHeaders();
38
39        $out = $this->getOutput();
40        $out->addModules( 'mediawiki.authenticationPopup.success' );
41
42        if ( $this->getUser()->isNamed() ) {
43            $out->setPageTitleMsg( $this->msg( 'loginsuccesstitle' ) );
44            $out->addWikiMsg( 'loginsuccess', wfEscapeWikiText( $this->getUser()->getName() ) );
45        } else {
46            $out->setPageTitleMsg( $this->msg( 'exception-nologin' ) );
47            $out->addWikiMsg( 'exception-nologin-text' );
48        }
49        $out->addWikiMsg( 'userlogin-authpopup-closeme' );
50    }
51}