36 parent::__construct(
'Confirmemail',
'editmyprivateinfo' );
54 $trxProfiler = Profiler::instance()->getTransactionProfiler();
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' );
105 $form = HTMLForm::factory(
'ooui', $descriptor, $this->
getContext() );
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 );
139 $status = $this->
getUser()->sendConfirmationMail();
140 if ( $status->isGood() ) {
141 return Status::newGood( $this->
msg(
'confirmemail_sent' )->text() );
144 $status->getWikiText(
'confirmemail_sendfailed',
false, $this->getLanguage() )
156 $user = User::newFromConfirmationCode( $code, User::READ_EXCLUSIVE );
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() ) {
Show an error when a user tries to do something they do not have the necessary permissions for.
Variant of the Message class.
Special page allows users to request email confirmation message, and handles processing of the confir...
attemptConfirm( $code)
Attempt to confirm the user's email address and show success or failure as needed; if successful,...
doesWrites()
Indicates whether this special page may perform database writes.
showRequestForm()
Show a nice form for the user to request a confirmation mail.
execute( $code)
Main execution point.
submitSend()
Callback for HTMLForm send confirmation mail.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
requireLogin( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
getUser()
Shortcut to get the User executing this instance.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
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,...
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
getPageTitle( $subpage=false)
Get a self-referential title object.
getLanguage()
Shortcut to get user's language.
isGood()
Returns whether the operation completed and didn't have any error or warnings.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Shortcut to construct a special page which is unlisted by default.
if(!isset( $args[0])) $lang