25 use Wikimedia\ScopedCallback;
44 parent::__construct(
'Confirmemail',
'editmyprivateinfo' );
72 if ( !$this->
getAuthority()->isAllowed(
'viewmyprivateinfo' ) ) {
76 if ( $code ===
null || $code ===
'' ) {
81 $this->
getOutput()->addWikiMsg(
'confirmemail_noemail' );
84 $scope = $trxProfiler->silenceForScope();
86 ScopedCallback::consume( $scope );
97 if ( !$user->isEmailConfirmed() ) {
99 if ( $user->isEmailConfirmationPending() ) {
104 'default' =>
"<div class=\"error mw-confirmemail-pending\">\n" .
105 $this->
msg(
'confirmemail_pending' )->escaped() .
111 $out->addWikiMsg(
'confirmemail_text' );
115 ->setSubmitTextMsg(
'confirmemail_send' )
116 ->setSubmitCallback( [ $this,
'submitSend' ] );
118 $retval = $form->show();
120 if ( $retval ===
true ) {
122 $out->addWikiMsg(
'confirmemail_sent' );
123 } elseif ( $retval instanceof
Status && $retval->
isGood() ) {
124 $out->addWikiTextAsInterface( $retval->getValue() );
131 $emailAuthenticated = $user->getEmailAuthenticationTimestamp();
132 $time =
$lang->userTimeAndDate( $emailAuthenticated, $user );
133 $d =
$lang->userDate( $emailAuthenticated, $user );
134 $t =
$lang->userTime( $emailAuthenticated, $user );
135 $out->addWikiMsg(
'emailauthenticated', $time, $d,
$t );
145 $status = $this->
getUser()->sendConfirmationMail();
146 if ( $status->isGood() ) {
150 $status->getWikiText(
'confirmemail_sendfailed',
false, $this->getLanguage() )
162 $user = $this->userFactory->newFromConfirmationCode(
164 UserFactory::READ_LATEST
167 if ( !is_object( $user ) ) {
168 $this->
getOutput()->addWikiMsg(
'confirmemail_invalid' );
174 if ( $user->pingLimiter(
'confirmemail' ) ) {
175 $this->
getOutput()->addWikiMsg(
'actionthrottledtext' );
180 $userLatest = $user->getInstanceForUpdate();
181 $userLatest->confirmEmail();
182 $userLatest->saveSettings();
183 $message = $this->
getUser()->isRegistered() ?
'confirmemail_loggedin' :
'confirmemail_success';
184 $this->
getOutput()->addWikiMsg( $message );
186 if ( !$this->
getUser()->isRegistered() ) {
Show an error when a user tries to do something they do not have the necessary permissions for.
static instance()
Singleton.
Variant of the Message class.
static validateEmail( $addr)
Does a string look like an e-mail address?
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.
__construct(UserFactory $userFactory)
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.
getAuthority()
Shortcut to get the Authority executing this instance.
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.
static newFatal( $message,... $parameters)
Factory function for fatal errors.
isGood()
Returns whether the operation completed and didn't have any error or warnings.
static newGood( $value=null)
Factory function for good results.
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