CoolCMS API

AdvertPasswordResetFormTrait

New password of a company profile placed without an account, from the one-time link of the "forgotten password" e-mail (`edit?id=...&resetKey=...`).

actionEdit() switches to this view when the visitor is not authorised yet and the link carries resetKey — the URL stays the edit page, no new route or page record is needed (same approach as the password view of AdvertAuthorizationFormTrait).

The key check, the write and the consumption of the key happen in the Api (:Api:Comcat:Advert:resetPassword). On success the visitor gets the same session token as after typing the password into the authorisation form — [id, hash, expiration] in self::sessionSection — so the edit opens right away.

Tags
requires

EditAdvertFormTrait — $advert, self::sessionSection

AdvertAuthorizationFormTrait — self::advertSessionExpiration

Table of Contents

Constants

manageLinkKeyPrefix  : string = 'front.comcat.presenters.advert.manageLink.'
passwordResetKeyPrefix  : string = 'front.comcat.presenters.advert.passwordReset.'

Properties

$advertPasswordResetManager  : AdvertPasswordResetManager

Methods

createComponentPasswordResetForm()  : Form
passwordResetFormSucceeded()  : void
renderPasswordReset()  : void
getPasswordResetKey()  : string
grantAdvertSessionAfterReset()  : void
Same session token as `AdvertAuthorizationFormTrait::authFormSucceeded()` writes after the password form. The hash is read back fresh from the Api — `checkAutorization()` compares it with the DB value on every request.
hasPasswordResetKey()  : bool
Does the request carry the reset key from the e-mailed link (query) or the form (POST)?
redeemManageKeyFromLink()  : void
Handles the "manage profile" link of the insertion e-mail (`edit?id=...&manageKey=...`), which replaces a readable password in the e-mail.

Constants

Properties

Methods

grantAdvertSessionAfterReset()

Same session token as `AdvertAuthorizationFormTrait::authFormSucceeded()` writes after the password form. The hash is read back fresh from the Api — `checkAutorization()` compares it with the DB value on every request.

private grantAdvertSessionAfterReset(int $advertId) : void
Parameters
$advertId : int

hasPasswordResetKey()

Does the request carry the reset key from the e-mailed link (query) or the form (POST)?

private hasPasswordResetKey() : bool
Return values
bool

Handles the "manage profile" link of the insertion e-mail (`edit?id=...&manageKey=...`), which replaces a readable password in the e-mail.

private redeemManageKeyFromLink(int $advertId) : void

The Api verifies the key (:Api:Comcat:Advert:redeemManageKey: digest, 7 days, bound to the current password). A valid key gives the same session as typing the password (self::grantAdvertSessionAfterReset()); an invalid or expired one gives a message and the password form. Either way the redirect to the edit page drops the key, so it stays out of the browser history and the Referer header. The key is not consumed; it is valid until it expires.

Parameters
$advertId : int
On this page

Search results