MediaWiki  master
RememberMeAuthenticationRequest.php
Go to the documentation of this file.
1 <?php
22 namespace MediaWiki\Auth;
23 
26 
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 }
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.
static getGlobalSession()
Get the "global" session.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
This is a value object for authentication requests.