/**
* String Some punctuation to prevent editing from broken text-mangling proxies.
- * @deprecated since 1.27, use \\MediaWiki\\Session\\Token::SUFFIX
+ * @deprecated since 1.27, use \MediaWiki\Session\Token::SUFFIX
* @ingroup Constants
*/
define( 'EDIT_TOKEN_SUFFIX', Token::SUFFIX );
/**
* Global constant made accessible as class constants so that autoloader
* magic can be used.
- * @deprecated since 1.27, use \\MediaWiki\\Session\\Token::SUFFIX
+ * @deprecated since 1.27, use \MediaWiki\Session\Token::SUFFIX
*/
const EDIT_TOKEN_SUFFIX = EDIT_TOKEN_SUFFIX;
// Clean up name according to title rules,
// but only when validation is requested (bug 12654)
$t = ( $validate !== false ) ?
- Title::newFromText( $name ) : Title::makeTitle( NS_USER, $name );
+ Title::newFromText( $name, NS_USER ) : Title::makeTitle( NS_USER, $name );
// Check for invalid titles
- if ( is_null( $t ) ) {
+ if ( is_null( $t ) || $t->getNamespace() !== NS_USER || $t->isExternal() ) {
return false;
}
return Status::newGood( true );
}
+ $type = $oldaddr != '' ? 'changed' : 'set';
+ $notificationResult = null;
+
+ if ( $wgEmailAuthentication ) {
+ // Send the user an email notifying the user of the change in registered
+ // email address on their previous email address
+ if ( $type == 'changed' ) {
+ $change = $str != '' ? 'changed' : 'removed';
+ $notificationResult = $this->sendMail(
+ wfMessage( 'notificationemail_subject_' . $change )->text(),
+ wfMessage( 'notificationemail_body_' . $change,
+ $this->getRequest()->getIP(),
+ $this->getName(),
+ $str )->text()
+ );
+ }
+ }
+
$this->setEmail( $str );
if ( $str !== '' && $wgEmailAuthentication ) {
// Send a confirmation request to the new address if needed
- $type = $oldaddr != '' ? 'changed' : 'set';
$result = $this->sendConfirmationMail( $type );
+
+ if ( $notificationResult !== null ) {
+ $result->merge( $notificationResult );
+ }
+
if ( $result->isGood() ) {
- // Say to the caller that a confirmation mail has been sent
+ // Say to the caller that a confirmation and notification mail has been sent
$result->value = 'eauth';
}
} else {
* @since 1.27
* @param string|array $salt Array of Strings Optional function-specific data for hashing
* @param WebRequest|null $request WebRequest object to use or null to use $wgRequest
- * @return MediaWiki\\Session\\Token The new edit token
+ * @return MediaWiki\Session\Token The new edit token
*/
public function getEditTokenObject( $salt = '', $request = null ) {
if ( $this->isAnon() ) {
/**
* Get the embedded timestamp from a token.
- * @deprecated since 1.27, use \\MediaWiki\\Session\\Token::getTimestamp instead.
+ * @deprecated since 1.27, use \MediaWiki\Session\Token::getTimestamp instead.
* @param string $val Input token
* @return int|null
*/