Go to the documentation of this file.
36 parent::__construct(
'Confirmemail',
'editmyprivateinfo' );
62 if ( !MediaWikiServices::getInstance()
64 ->userHasRight( $this->
getUser(),
'viewmyprivateinfo' )
69 if ( $code ===
null || $code ===
'' ) {
71 if ( Sanitizer::validateEmail( $this->
getUser()->getEmail() ) ) {
74 $this->
getOutput()->addWikiMsg(
'confirmemail_noemail' );
77 $old = $trxProfiler->setSilenced(
true );
79 $trxProfiler->setSilenced( $old );
90 if ( !$user->isEmailConfirmed() ) {
92 if ( $user->isEmailConfirmationPending() ) {
97 'default' =>
"<div class=\"error mw-confirmemail-pending\">\n" .
98 $this->
msg(
'confirmemail_pending' )->escaped() .
104 $out->addWikiMsg(
'confirmemail_text' );
107 ->setMethod(
'post' )
109 ->setSubmitTextMsg(
'confirmemail_send' )
110 ->setSubmitCallback( [ $this,
'submitSend' ] );
112 $retval = $form->show();
114 if ( $retval ===
true ) {
116 $out->addWikiMsg(
'confirmemail_sent' );
117 } elseif ( $retval instanceof
Status && $retval->
isGood() ) {
118 $out->addWikiTextAsInterface( $retval->getValue() );
125 $emailAuthenticated = $user->getEmailAuthenticationTimestamp();
126 $time =
$lang->userTimeAndDate( $emailAuthenticated, $user );
127 $d =
$lang->userDate( $emailAuthenticated, $user );
128 $t =
$lang->userTime( $emailAuthenticated, $user );
129 $out->addWikiMsg(
'emailauthenticated', $time, $d,
$t );
144 $status->getWikiText(
'confirmemail_sendfailed',
false, $this->getLanguage() )
157 if ( !is_object( $user ) ) {
158 $this->
getOutput()->addWikiMsg(
'confirmemail_invalid' );
164 if ( $user->pingLimiter(
'confirmemail' ) ) {
165 $this->
getOutput()->addWikiMsg(
'actionthrottledtext' );
170 $user->confirmEmail();
171 $user->saveSettings();
172 $message = $this->
getUser()->isLoggedIn() ?
'confirmemail_loggedin' :
'confirmemail_success';
173 $this->
getOutput()->addWikiMsg( $message );
175 if ( !$this->
getUser()->isLoggedIn() ) {
getPageTitle( $subpage=false)
Get a self-referential title object.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
static newFatal( $message,... $parameters)
Factory function for fatal errors.
getOutput()
Get the OutputPage being used for this instance.
static instance()
Singleton.
if(!isset( $args[0])) $lang
Shortcut to construct a special page which is unlisted by default.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
showRequestForm()
Show a nice form for the user to request a confirmation mail.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Show an error when a user tries to do something they do not have the necessary permissions for.
attemptConfirm( $code)
Attempt to confirm the user's email address and show success or failure as needed; if successful,...
getLanguage()
Shortcut to get user's language.
Special page allows users to request email confirmation message, and handles processing of the confir...
submitSend()
Callback for HTMLForm send confirmation mail.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
isGood()
Returns whether the operation completed and didn't have any error or warnings.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getUser()
Shortcut to get the User executing this instance.
getContext()
Gets the context this SpecialPage is executed in.
requireLogin( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
static newGood( $value=null)
Factory function for good results.
doesWrites()
Indicates whether this special page may perform database writes.
execute( $code)
Main execution point.
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
static newFromConfirmationCode( $code, $flags=0)
Factory method to fetch whichever user has a given email confirmation code.
Variant of the Message class.