14use Wikimedia\ScopedCallback;
28 parent::__construct(
'Invalidateemail',
'editmyprivateinfo' );
30 $this->userFactory = $userFactory;
40// Ignore things like primary queries/connections on GET requests. 41// It's very convenient to just allow formless link usage. 48 $scope = $trxProfiler->silenceForScope( $trxProfiler::EXPECTATION_REPLICAS_ONLY );
49 $this->attemptInvalidate( $code );
50 ScopedCallback::consume( $scope );
59privatefunction attemptInvalidate( $code ) {
60 $user = $this->userFactory->newFromConfirmationCode(
62 IDBAccessObject::READ_LATEST
65if ( !is_object( $user ) ) {
66 $this->
getOutput()->addWikiMsg(
'confirmemail_invalid' );
71 $userLatest = $user->getInstanceFromPrimary() ??
thrownew LogicException(
'No user' );
72 $userLatest->invalidateEmail();
73 $userLatest->saveSettings();
74 $this->
getOutput()->addWikiMsg(
'confirmemail_invalidated' );
76if ( !$this->
getUser()->isRegistered() ) {
83class_alias( SpecialEmailInvalidate::class,
'SpecialEmailInvalidate' );
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getUser()
Shortcut to get the User executing this instance.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
getOutput()
Get the OutputPage being used for this instance.
Shortcut to construct a special page which is unlisted by default.
Cancel an email confirmation using the e-mail confirmation code.
execute( $code)
Default execute method Checks user permissions.This must be overridden by subclasses; it will be made...
doesWrites()
Indicates whether POST requests to this special page require write access to the wiki....
__construct(UserFactory $userFactory)
Profiler base class that defines the interface and some shared functionality.
Interface for database access objects.