Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 3 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
AccountCreationEventProvider | |
0.00% |
0 / 3 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
postAccountCreation | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | namespace WikimediaEvents; |
3 | |
4 | use MediaWiki\Auth\AbstractPreAuthenticationProvider; |
5 | use MediaWiki\Auth\AuthenticationResponse; |
6 | use MediaWiki\User\User; |
7 | |
8 | class AccountCreationEventProvider extends AbstractPreAuthenticationProvider { |
9 | /** |
10 | * @var AccountCreationLogger |
11 | */ |
12 | private AccountCreationLogger $accountCreationLogger; |
13 | |
14 | public function __construct( AccountCreationLogger $accountCreationLogger ) { |
15 | $this->accountCreationLogger = $accountCreationLogger; |
16 | } |
17 | |
18 | /** |
19 | * @param User $user User that was attempted to be created. |
20 | * @param User $creator User doing the creation. |
21 | * @param AuthenticationResponse $response (PASS or FAIL). |
22 | * Based on this response, the event type is set to 'success' |
23 | * for PASS and 'failure' for FAIL. |
24 | */ |
25 | public function postAccountCreation( |
26 | $user, $creator, AuthenticationResponse $response ) { |
27 | $eventType = $response->status === AuthenticationResponse::PASS ? 'success' : 'failure'; |
28 | $this->accountCreationLogger->logAccountCreationEvent( $eventType, $creator, $response ); |
29 | } |
30 | } |