mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Rework email_activation model, get rid of behaviors, use json column to store additional data
This commit is contained in:
@@ -17,11 +17,11 @@ class EmailVerificationAction extends BaseAccountAction {
|
||||
return [];
|
||||
}
|
||||
|
||||
/** @var \common\models\EmailActivation $emailActivation */
|
||||
$emailActivation = $model->getEmailActivation();
|
||||
|
||||
return [
|
||||
'canRepeatIn' => $emailActivation->canRepeatIn(),
|
||||
'repeatFrequency' => $emailActivation->repeatTimeout,
|
||||
'canRepeatIn' => $emailActivation->canResendAt()->getTimestamp(),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -31,7 +31,7 @@ class SendEmailVerificationForm extends AccountActionForm {
|
||||
public function validateFrequency(string $attribute): void {
|
||||
if (!$this->hasErrors()) {
|
||||
$emailConfirmation = $this->getEmailActivation();
|
||||
if ($emailConfirmation !== null && !$emailConfirmation->canRepeat()) {
|
||||
if ($emailConfirmation !== null && !$emailConfirmation->canResend()) {
|
||||
$this->addError($attribute, E::RECENTLY_SENT_MESSAGE);
|
||||
}
|
||||
}
|
||||
@@ -80,6 +80,8 @@ class SendEmailVerificationForm extends AccountActionForm {
|
||||
* The method is designed to check if the E-mail change messages are sent too often.
|
||||
* Including checking for the confirmation of the new E-mail type, because when you go to this step,
|
||||
* the activation of the previous step is removed.
|
||||
*
|
||||
* @return CurrentEmailConfirmation|\common\models\confirmations\NewEmailConfirmation
|
||||
*/
|
||||
public function getEmailActivation(): ?EmailActivation {
|
||||
return $this->getAccount()
|
||||
|
Reference in New Issue
Block a user