MediaWiki
1.34.0
RememberMeAuthenticationRequest.php
Go to the documentation of this file.
1
<?php
22
namespace
MediaWiki\Auth
;
23
24
use
MediaWiki\Session\SessionManager
;
25
use
MediaWiki\Session\SessionProvider
;
26
33
class
RememberMeAuthenticationRequest
extends
AuthenticationRequest
{
34
35
public
$required
=
self::OPTIONAL
;
36
38
protected
$expiration
=
null
;
39
41
public
$rememberMe
=
false
;
42
43
public
function
__construct
() {
45
$provider =
SessionManager::getGlobalSession
()->getProvider();
46
'@phan-var SessionProvider $provider'
;
47
$this->expiration = $provider->getRememberUserDuration();
48
}
49
50
public
function
getFieldInfo
() {
51
if
( !$this->expiration ) {
52
return
[];
53
}
54
55
$expirationDays = ceil( $this->expiration / ( 3600 * 24 ) );
56
return
[
57
'rememberMe'
=> [
58
'type'
=>
'checkbox'
,
59
'label'
=>
wfMessage
(
'userlogin-remembermypassword'
)->numParams( $expirationDays ),
60
'help'
=>
wfMessage
(
'authmanager-userlogin-remembermypassword-help'
),
61
'optional'
=>
true
,
62
'skippable'
=>
true
,
63
]
64
];
65
}
66
}
MediaWiki\Auth\RememberMeAuthenticationRequest\$expiration
int $expiration
How long the user will be remembered, in seconds.
Definition:
RememberMeAuthenticationRequest.php:38
MediaWiki\Auth\AuthenticationRequest\OPTIONAL
const OPTIONAL
Indicates that the request is not required for authentication to proceed.
Definition:
AuthenticationRequest.php:40
MediaWiki\Auth\RememberMeAuthenticationRequest\getFieldInfo
getFieldInfo()
Fetch input field info.
Definition:
RememberMeAuthenticationRequest.php:50
MediaWiki\Auth\RememberMeAuthenticationRequest\__construct
__construct()
Definition:
RememberMeAuthenticationRequest.php:43
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition:
GlobalFunctions.php:1264
MediaWiki\Auth\RememberMeAuthenticationRequest\$required
$required
Definition:
RememberMeAuthenticationRequest.php:35
MediaWiki\Auth\RememberMeAuthenticationRequest\$rememberMe
bool $rememberMe
Definition:
RememberMeAuthenticationRequest.php:41
MediaWiki\Session\SessionProvider
A SessionProvider provides SessionInfo and support for Session.
Definition:
SessionProvider.php:78
MediaWiki\Session\SessionManager\getGlobalSession
static getGlobalSession()
Get the "global" session.
Definition:
SessionManager.php:106
MediaWiki\Session\SessionManager
This serves as the entry point to the MediaWiki session handling system.
Definition:
SessionManager.php:50
MediaWiki\Auth\RememberMeAuthenticationRequest
This is an authentication request added by AuthManager to show a "remember me" checkbox.
Definition:
RememberMeAuthenticationRequest.php:33
MediaWiki\Auth
Definition:
AbstractAuthenticationProvider.php:22
MediaWiki\Auth\AuthenticationRequest
This is a value object for authentication requests.
Definition:
AuthenticationRequest.php:37
includes
auth
RememberMeAuthenticationRequest.php
Generated on Thu Dec 19 2019 14:54:07 for MediaWiki by
1.8.16