$wgOut->setArticleRelated( false );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->addHtml( wfMsgWikiHtml( 'accountcreatedtext', $u->getName() ) );
- $wgOut->returnToMain( $self->getPrefixedText() );
+ $wgOut->returnToMain( false, $self );
wfRunHooks( 'AddNewAccount', array( $u ) );
return true;
}
global $wgEnableSorbs, $wgProxyWhitelist;
global $wgMemc, $wgAccountCreationThrottle;
global $wgAuth, $wgMinimalPasswordLength;
+ global $wgEmailConfirmToEdit;
// If the user passes an invalid domain, something is fishy
if( !$wgAuth->validDomain( $this->mDomain ) ) {
return false;
}
- # Check anonymous user ($wgUser) limitations :
- if (!$wgUser->isAllowedToCreateAccount()) {
+ # Check permissions
+ if ( !$wgUser->isAllowed( 'createaccount' ) ) {
$this->userNotPrivilegedMessage();
return false;
+ } elseif ( $wgUser->isBlockedFromCreateAccount() ) {
+ $this->userBlockedMessage();
+ return false;
}
$ip = wfGetIP();
return false;
}
+ # if you need a confirmed email address to edit, then obviously you need an email address.
+ if ( $wgEmailConfirmToEdit && empty( $this->mEmail ) ) {
+ $this->mainLoginForm( wfMsg( 'noemailtitle' ) );
+ return false;
+ }
+
+ if( !empty( $this->mEmail ) && !User::isValidEmailAddr( $this->mEmail ) ) {
+ $this->mainLoginForm( wfMsg( 'invalidemailaddress' ) );
+ return false;
+ }
+
# Set some additional data so the AbortNewAccount hook can be
# used for more than just username validation
$u->setEmail( $this->mEmail );
$wgOut->setArticleRelated( false );
$ip = wfGetIP();
- $blocker = User::whoIs($wgUser->mBlock->mBy);
+ $blocker = User::whoIs( $wgUser->mBlock->mBy );
$block_reason = $wgUser->mBlock->mReason;
- $wgOut->addWikiText( wfMsg( 'cantcreateaccounttext', $ip, $block_reason, $blocker ) );
+ $wgOut->addWikiText( wfMsg( 'cantcreateaccount-text', $ip, $block_reason, $blocker ) );
$wgOut->returnToMain( false );
}
function mainLoginForm( $msg, $msgtype = 'error' ) {
global $wgUser, $wgOut, $wgAllowRealName, $wgEnableEmail;
global $wgCookiePrefix, $wgAuth, $wgLoginLanguageSelector;
- global $wgAuth;
+ global $wgAuth, $wgEmailConfirmToEdit;
if ( $this->mType == 'signup' ) {
if ( !$wgUser->isAllowed( 'createaccount' ) ) {
$template->set( 'createemail', $wgEnableEmail && $wgUser->isLoggedIn() );
$template->set( 'userealname', $wgAllowRealName );
$template->set( 'useemail', $wgEnableEmail );
+ $template->set( 'emailrequired', $wgEmailConfirmToEdit );
$template->set( 'canreset', $wgAuth->allowPasswordChange() );
$template->set( 'remember', $wgUser->getOption( 'rememberpassword' ) or $this->mRemember );