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() );
108 ->setSubmitTextMsg(
'confirmemail_send' )
109 ->setSubmitCallback( [ $this,
'submitSend' ] );
111 $retval = $form->show();
113 if ( $retval ===
true ) {
115 $out->addWikiMsg(
'confirmemail_sent' );
116 } elseif ( $retval instanceof
Status && $retval->
isGood() ) {
117 $out->addWikiTextAsInterface( $retval->getValue() );
124 $emailAuthenticated = $user->getEmailAuthenticationTimestamp();
125 $time =
$lang->userTimeAndDate( $emailAuthenticated, $user );
126 $d =
$lang->userDate( $emailAuthenticated, $user );
127 $t =
$lang->userTime( $emailAuthenticated, $user );
128 $out->addWikiMsg(
'emailauthenticated', $time, $d,
$t );
138 $status = $this->
getUser()->sendConfirmationMail();
139 if ( $status->isGood() ) {
140 return Status::newGood( $this->
msg(
'confirmemail_sent' )->text() );
143 $status->getWikiText(
'confirmemail_sendfailed',
false, $this->getLanguage() )
156 if ( !is_object( $user ) ) {
157 $this->
getOutput()->addWikiMsg(
'confirmemail_invalid' );
163 if ( $user->pingLimiter(
'confirmemail' ) ) {
164 $this->
getOutput()->addWikiMsg(
'actionthrottledtext' );
169 $user->confirmEmail();
170 $user->saveSettings();
171 $message = $this->
getUser()->isLoggedIn() ?
'confirmemail_loggedin' :
'confirmemail_success';
172 $this->
getOutput()->addWikiMsg( $message );
174 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.
static newFromConfirmationCode( $code, $flags=0)
Factory method to fetch whichever user has a given email confirmation code.
if(!isset( $args[0])) $lang