CoolCMS API

MessageConfirmTrait

Confirms a post by its author through the link in the e-mail `DS_MESSAGE_ACTIVATION_REQUEST` (`/diskuze/.../<id>-<subject>?do=confirm&key=...`, built by the Api `MessageConfirmationTrait`).

Same approach as the advert detail (AdvertConfirmTrait::handleConfirm()).

Tags
requires

MessageDetailTrait collectMessageVisibilityIssues() (message "confirmed, awaiting approval...")

Table of Contents

Methods

handleConfirm()  : void
Confirms the post by the key from the e-mail link.

Methods

handleConfirm()

Confirms the post by the key from the e-mail link.

public handleConfirm() : void

IMPORTANT: Nette forces Requires(sameOrigin: true) on every handle*(), and a click from a mail client is cross-site (Sec-Fetch-Site: none), so the handler would silently not run. The link is protected by the key, not by the origin, hence #[CrossOrigin]. An unconfirmed post is hidden from anonymous users (actionDetail() nulls $this->message), so the handler works only with the id from the URL.

The Api action confirmByKey verifies the key, writes and applies the limit (five layers, so an internal bridge; ConfirmByKeyTrait). The response does not distinguish an unknown post from a wrong key, and the front end does not either (one error message). Repeating the click with the right key is a success.

Attributes
#[CrossOrigin]
On this page

Search results