forked from wikimedia/mediawiki-extensions-NewSignupPage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNewSignupPageAuthenticationRequest.php
65 lines (57 loc) · 1.6 KB
/
NewSignupPageAuthenticationRequest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
use MediaWiki\Auth\AuthenticationRequest;
/**
* @ingroup Auth
* @since MediaWiki 1.27
*/
class NewSignupPageAuthenticationRequest extends AuthenticationRequest {
public $required = self::REQUIRED; // only ToS check is mandatory
/**
* @var int $from Email invitation source identifier to be stored in the
* user_email_track table
* @see /extensions/SocialProfile/UserStats/UserStatsClass.php for details
*/
public $from;
/**
* @var string|int Username of the person who referred the user creating an
* account to the wiki; used to give out points to the referring user and
* also automatically friend them and the new user if that configuration
* setting is enabled
*/
public $referral;
/**
* @var bool $wpTermsOfService Was the "I agree to the terms of service"
* checkbox checked? It must be in order for the account creation process
* to continue.
*/
public $wpTermsOfService;
/**
* @param WebRequest $request
*/
public function __construct( $request ) {
$this->request = $request;
}
public function getFieldInfo() {
return [
'from' => [
'type' => 'hidden',
'optional' => true,
'value' => $this->request->getInt( 'from' )
],
'referral' => [
'type' => 'hidden',
'optional' => true,
'value' => $this->request->getVal( 'referral' )
],
'wpTermsOfService' => [
'type' => 'checkbox',
'label' => wfMessage( 'shoutwiki-loginform-tos' )
]
];
}
public function loadFromSubmission( array $data ) {
// We always want to use this request, so ignore parent's return value.
parent::loadFromSubmission( $data );
return true;
}
}