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:
@@ -51,7 +51,7 @@ class ForgotPasswordForm extends ApiForm {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@ class ForgotPasswordForm extends ApiForm {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getEmailActivation(): ?EmailActivation {
|
||||
public function getEmailActivation(): ?ForgotPassword {
|
||||
$account = $this->getAccount();
|
||||
if ($account === null) {
|
||||
return null;
|
||||
|
@@ -50,7 +50,7 @@ class RepeatAccountActivationForm extends ApiForm {
|
||||
public function validateExistsActivation(string $attribute): void {
|
||||
if (!$this->hasErrors()) {
|
||||
$activation = $this->getActivation();
|
||||
if ($activation !== null && !$activation->canRepeat()) {
|
||||
if ($activation !== null && !$activation->canResend()) {
|
||||
$this->addError($attribute, E::RECENTLY_SENT_MESSAGE);
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ class RepeatAccountActivationForm extends ApiForm {
|
||||
->one();
|
||||
}
|
||||
|
||||
public function getActivation(): ?EmailActivation {
|
||||
public function getActivation(): ?RegistrationConfirmation {
|
||||
return $this->getAccount()
|
||||
->getEmailActivations()
|
||||
->withType(EmailActivation::TYPE_REGISTRATION_EMAIL_CONFIRMATION)
|
||||
|
Reference in New Issue
Block a user