* Bug 11620 - Added call to User::isValidEmailAddr during accout creation.
* Bug 11629 - If $wgEmailConfirmToEdit is true, require people to supply an
email address when registering.
* adding "prefs-help-email-required" message (which says an email address is required)
to complement the existing "prefs-help-email" (which says an email address is optional).
The former makes sense when $wgEmailConfirmToEdit is true, whereas the latter makes
sense for the default behaviour (which is for $wgEmailConfirmToEdit to be false).
* Using the "prefs-help-email-required" message in Special:Userlogin and Special:Preferences
when it makes sense to do so.
* Removing EditPage::userNotConfirmedPage() - as far as I can tell, it is not being
used internally, or by any extensions. Furthermore, its functionality is superceded by
the $wgEmailConfirmToEdit global and the check on it in Title.php
* Do not cache category pages if using 'from' or 'until'
* Created new hook getUserPermissionsErrors, to go with userCan changes.
* Diff pages did not properly display css/js pages.
+* (bug 11620) Add call to User::isValidEmailAddr during accout creation.
+* (bug 11629) If $wgEmailConfirmToEdit is true, require people to supply an
+ email address when registering.
+
=== API changes in 1.12 ===
$wgOut->returnToMain( false, $this->mTitle );
}
- /**
- * Creates a basic error page which informs the user that
- * they have to validate their email address before being
- * allowed to edit.
- */
- function userNotConfirmedPage() {
- global $wgOut;
-
- $wgOut->setPageTitle( wfMsg( 'confirmedittitle' ) );
- $wgOut->setRobotPolicy( 'noindex,nofollow' );
- $wgOut->setArticleRelated( false );
-
- $wgOut->addWikiText( wfMsg( 'confirmedittext' ) );
- $wgOut->returnToMain( false, $this->mTitle );
- }
-
/**
* Creates a basic error page which informs the user that
* they have attempted to edit a nonexistant section.
global $wgUser, $wgOut, $wgParser;
global $wgEnableUserEmail, $wgEnableEmail;
global $wgEmailAuthentication;
- global $wgAuth;
+ global $wgAuth, $wgEmailConfirmToEdit;
if ( '' != $this->mNewpass && $wgAuth->allowPasswordChange() ) {
$error = wfMsg( 'invalidemailaddress' );
}
} else {
+ if( $wgEmailConfirmToEdit && empty( $newadr ) ) {
+ $this->mainPrefsForm( 'error', wfMsg( 'noemailtitle' ) );
+ return;
+ }
$wgUser->setEmail( $this->mUserEmail );
$wgUser->setCookies();
$wgUser->saveSettings();
global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins, $wgAuth;
+ global $wgEmailConfirmToEdit;
$wgOut->setPageTitle( wfMsg( 'preferences' ) );
$wgOut->setArticleRelated( false );
Xml::label( wfMsg('youremail'), 'wpUserEmail' ),
Xml::input( 'wpUserEmail', 25, $this->mUserEmail, array( 'id' => 'wpUserEmail' ) ),
Xml::tags('div', array( 'class' => 'prefsectiontip' ),
- wfMsgExt( 'prefs-help-email', 'parseinline' )
+ wfMsgExt( $wgEmailConfirmToEdit ? 'prefs-help-email-required' : 'prefs-help-email', 'parseinline' )
)
)
);
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;
}
+ # 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 );
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 );
* @param string $action action that permission needs to be checked for
* @param bool $doExpensiveQueries Set this to false to avoid doing unnecessary queries.
* @return array Array of arrays of the arguments to wfMsg to explain permissions problems.
- */
+ */
public function getUserPermissionsErrors( $action, $user, $doExpensiveQueries = true ) {
$errors = $this->getUserPermissionsErrorsInternal( $action, $user, $doExpensiveQueries );
tabindex="5"
value="<?php $this->text('email') ?>" size='20' />
<div class="prefsectiontip">
- <?php $this->msgWiki('prefs-help-email'); ?>
+ <?php if( $this->data['emailrequired'] ) {
+ $this->msgWiki('prefs-help-email-required');
+ } else {
+ $this->msgWiki('prefs-help-email');
+ } ?>
</div>
</td>
<?php } ?>
'prefs-help-realname' => 'Real name is optional and if you choose to provide it this will be used for giving you attribution for your work.',
'loginerror' => 'Login error',
'prefs-help-email' => 'E-mail address is optional, but it enables others to contact you through your user or user_talk page without needing to reveal your identity.',
+'prefs-help-email-required' => 'E-mail address is required.',
'nocookiesnew' => 'The user account was created, but you are not logged in. {{SITENAME}} uses cookies to log in users. You have cookies disabled. Please enable them, then log in with your new username and password.',
'nocookieslogin' => '{{SITENAME}} uses cookies to log in users. You have cookies disabled. Please enable them and try again.',
'noname' => 'You have not specified a valid user name.',