MediaWiki REL1_35
RememberMeAuthenticationRequest.php
Go to the documentation of this file.
1<?php
22namespace MediaWiki\Auth;
23
26
35
37
39 protected $expiration = null;
40
42 public $rememberMe = false;
43
47 public function __construct() {
49 $provider = SessionManager::getGlobalSession()->getProvider();
50 '@phan-var SessionProvider $provider';
51 $this->expiration = $provider->getRememberUserDuration();
52 }
53
58 public function getFieldInfo() {
59 if ( !$this->expiration ) {
60 return [];
61 }
62
63 $expirationDays = ceil( $this->expiration / ( 3600 * 24 ) );
64 return [
65 'rememberMe' => [
66 'type' => 'checkbox',
67 'label' => wfMessage( 'userlogin-remembermypassword' )->numParams( $expirationDays ),
68 'help' => wfMessage( 'authmanager-userlogin-remembermypassword-help' ),
69 'optional' => true,
70 'skippable' => true,
71 ]
72 ];
73 }
74}
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.
getFieldInfo()
Fetch input field info.The field info is an associative array mapping field names to info arrays....
This serves as the entry point to the MediaWiki session handling system.
A SessionProvider provides SessionInfo and support for Session.