AdvertPasswordResetFormTrait
New password of an advert placed without an account, from the one-time link of "forgot password" (`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:Bazaar: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
Table of Contents
Constants
- manageLinkKeyPrefix : string = 'front.bazaar.presenters.advert.manageLink.'
- passwordResetKeyPrefix : string = 'front.bazaar.presenters.advert.passwordReset.'
Properties
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 "advert management" link from the insertion e-mail (`edit?id=...&manageKey=...`), which replaces the readable password the e-mail carried before.
Constants
manageLinkKeyPrefix
private
string
manageLinkKeyPrefix
= 'front.bazaar.presenters.advert.manageLink.'
passwordResetKeyPrefix
private
string
passwordResetKeyPrefix
= 'front.bazaar.presenters.advert.passwordReset.'
Properties
$advertPasswordResetManager
public
AdvertPasswordResetManager
$advertPasswordResetManager
Attributes
- #[Inject]
Methods
createComponentPasswordResetForm()
public
createComponentPasswordResetForm() : Form
Return values
FormpasswordResetFormSucceeded()
public
passwordResetFormSucceeded(Form $form) : void
Parameters
- $form : Form
renderPasswordReset()
public
renderPasswordReset() : void
getPasswordResetKey()
private
getPasswordResetKey() : string
Return values
stringgrantAdvertSessionAfterReset()
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
boolredeemManageKeyFromLink()
Handles the "advert management" link from the insertion e-mail (`edit?id=...&manageKey=...`), which replaces the readable password the e-mail carried before.
private
redeemManageKeyFromLink(int $advertId) : void
The Api verifies the key (:Api:Bazaar:Advert:redeemManageKey: digest, 7 days, bound to the
current password). A valid key creates the same session as typing the password
(self::grantAdvertSessionAfterReset()); an invalid or expired one gives a message and the
password form. Both cases redirect to the edit page without 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