MediaWiki REL1_34
RememberMeAuthenticationRequest.php
Go to the documentation of this file.
1<?php
22namespace MediaWiki\Auth;
23
26
34
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}
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
This is a value object for authentication requests.
const OPTIONAL
Indicates that the request is not required for authentication to proceed.
This is an authentication request added by AuthManager to show a "remember me" checkbox.
int $expiration
How long the user will be remembered, in seconds.
This serves as the entry point to the MediaWiki session handling system.
static getGlobalSession()
Get the "global" session.
A SessionProvider provides SessionInfo and support for Session.