$this->setHeaders();
$this->checkPermissions();
- // Make sure it's possible to log in
- if ( !$this->isSignup() && !$session->canSetUser() ) {
- throw new ErrorPageError( 'cannotloginnow-title', 'cannotloginnow-text', [
+ // Make sure the system configuration allows log in / sign up
+ if ( !$this->isSignup() && !$authManager->canAuthenticateNow() ) {
+ if ( !$session->canSetUser() ) {
+ throw new ErrorPageError( 'cannotloginnow-title', 'cannotloginnow-text', [
$session->getProvider()->describe( RequestContext::getMain()->getLanguage() )
] );
+ }
+ throw new ErrorPageError( 'cannotlogin-title', 'cannotlogin-text' );
+ } elseif ( $this->isSignup() && !$authManager->canCreateAccounts() ) {
+ throw new ErrorPageError( 'cannotcreateaccount-title', 'cannotcreateaccount-text' );
}
/*
'class' => 'mw-ui-flush-right mw-secure',
], $this->msg( 'userlogin-signwithsecure' )->text() );
}
+ $usernameHelpLink = '';
+ if ( !$this->msg( 'createacct-helpusername' )->isDisabled() ) {
+ $usernameHelpLink = Html::rawElement( 'span', [
+ 'class' => 'mw-ui-flush-right',
+ ], $this->msg( 'createacct-helpusername' )->parse() );
+ }
if ( $this->isSignup() ) {
$fieldDefinitions = [
'weight' => -105,
],
'username' => [
- 'label-message' => 'userlogin-yourname',
- // FIXME help-message does not match old formatting
- 'help-message' => 'createacct-helpusername',
+ 'label-raw' => $this->msg( 'userlogin-yourname' )->escaped() . $usernameHelpLink,
'id' => 'wpName2',
'placeholder-message' => $isLoggedIn ? 'createacct-another-username-ph'
: 'userlogin-yourname-ph',