FormTrait
Table of Contents
Methods
- onError() : void
- onSuccess() : void
- validateBlacklist() : void
- One blacklist check of the e-mail, phone and visitor IP ({@see BlacklistManager::findBlacklistedTypes()}), run after the field rules passed. A blocked e-mail or phone is reported at its field, a blocked IP (single address or prefix range) at the form.
- createComponentRegistrationForm() : Form
- addAddressFields() : void
- addAvatarField() : void
- addCompanyFields() : void
- addContactFields() : void
- addLoginFields() : void
- controlText() : string
- Hodnota pole jako string — `IControl::getValue()` je `mixed`.
- isFree() : bool
- Translates the `usernameExists()`/`emailExists()` response into a validation rule result.
- preparePaymentRegions() : array<int, string>
-
prepareUserTypes()
: array{array
, int[], int[]}
Methods
onError()
public
onError(Form $form) : void
Parameters
- $form : Form
onSuccess()
public
onSuccess(Form $form, ArrayHash $values) : void
Parameters
- $form : Form
- $values : ArrayHash
validateBlacklist()
One blacklist check of the e-mail, phone and visitor IP ({@see BlacklistManager::findBlacklistedTypes()}), run after the field rules passed. A blocked e-mail or phone is reported at its field, a blocked IP (single address or prefix range) at the form.
public
validateBlacklist(Form $form) : void
IMPORTANT: the query goes through isBlacklisted (blocked types only), not the generic getBy,
which made the whole blacklist readable to anyone with a token. It is fail-closed like
self::isFree(): when the Api does not answer, the registration is refused, otherwise an
outage or a missing grant would silently switch the check off.
Parameters
- $form : Form
createComponentRegistrationForm()
protected
createComponentRegistrationForm() : Form
Return values
FormaddAddressFields()
private
addAddressFields(Form $form, callable $t) : void
Parameters
- $form : Form
- $t : callable
addAvatarField()
private
addAvatarField(Form $form, callable $t) : void
Parameters
- $form : Form
- $t : callable
addCompanyFields()
private
addCompanyFields(Form $form, callable $t) : void
Parameters
- $form : Form
- $t : callable
addContactFields()
private
addContactFields(Form $form, callable $t) : void
Parameters
- $form : Form
- $t : callable
addLoginFields()
private
addLoginFields(Form $form, callable $t) : void
Parameters
- $form : Form
- $t : callable
controlText()
Hodnota pole jako string — `IControl::getValue()` je `mixed`.
private
controlText(IControl $control) : string
Parameters
- $control : IControl
Return values
stringisFree()
Translates the `usernameExists()`/`emailExists()` response into a validation rule result.
private
isFree(bool|null $exists) : bool
IMPORTANT: it replaces isUnique(), which looked the account up itself through
userManager->findBy() = :Api:System:User:getBy. That action is admin-only and returned
null through FailSoftReadTrait under enforce, and null === null evaluated as "the
name is free", so registration reported no duplicates at all and only the unique indexes
uq_username / uq_email remained as a safeguard.
A null (the Api did not answer: guard or outage) is deliberately evaluated as invalid
(fail-closed): the user sees "already exists" and retries, instead of passing on to a
duplicate and failing on the database constraint.
Parameters
- $exists : bool|null
Return values
boolpreparePaymentRegions()
private
preparePaymentRegions() : array<int, string>
Return values
array<int, string>prepareUserTypes()
private
prepareUserTypes() : array{array, int[], int[]}