MediaWiki master
CheckBlocksSecondaryAuthenticationProvider.php
Go to the documentation of this file.
1<?php
22namespace MediaWiki\Auth;
23
25
36
38 protected $blockDisablesLogin = null;
39
45 public function __construct( $params = [] ) {
46 if ( isset( $params['blockDisablesLogin'] ) ) {
47 $this->blockDisablesLogin = (bool)$params['blockDisablesLogin'];
48 }
49 }
50
52 protected function postInitSetup() {
53 $this->blockDisablesLogin ??= $this->config->get( MainConfigNames::BlockDisablesLogin );
54 }
55
57 public function getAuthenticationRequests( $action, array $options ) {
58 return [];
59 }
60
62 public function beginSecondaryAuthentication( $user, array $reqs ) {
63 if ( !$this->blockDisablesLogin ) {
65 }
66 $block = $user->getBlock();
67 // Ignore IP blocks and partial blocks, $wgBlockDisablesLogin was meant for
68 // blocks banning specific users.
69 if ( $block && $block->isSitewide() && $block->isBlocking( $user ) ) {
71 new \Message( 'login-userblocked', [ $user->getName() ] )
72 );
73 } else {
75 }
76 }
77
79 public function beginSecondaryAccountCreation( $user, $creator, array $reqs ) {
81 }
82
83}
A base class that implements some of the boilerplate for a SecondaryAuthenticationProvider.
static newFail(Message $msg, array $failReasons=[])
Check if the user is blocked, and prevent authentication if so.
beginSecondaryAccountCreation( $user, $creator, array $reqs)
Start an account creation flow.There is no guarantee this will be called in a successful account crea...
getAuthenticationRequests( $action, array $options)
Return the applicable list of AuthenticationRequests.Possible values for $action depend on whether th...
beginSecondaryAuthentication( $user, array $reqs)
Start an authentication flow.Note that this may be called for a user even if beginSecondaryAccountCre...
postInitSetup()
A provider can override this to do any necessary setup after init() is called.1.37 to override
A class containing constants representing the names of configuration variables.
const BlockDisablesLogin
Name constant for the BlockDisablesLogin setting, for use with Config::get()
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition Message.php:157