Changeset View
Changeset View
Standalone View
Standalone View
src/app/Observers/SignupCodeObserver.php
Show All 29 Lines | public function creating(SignupCode $code): void | ||||
$code->code = Str::random($code_length); | $code->code = Str::random($code_length); | ||||
if (!SignupCode::find($code->code)) { | if (!SignupCode::find($code->code)) { | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
$code->expires_at = Carbon::now()->addHours($exp_hours); | $code->expires_at = Carbon::now()->addHours($exp_hours); | ||||
$code->ip_address = \App\Utils::requestIp(); | |||||
} | } | ||||
} | } | ||||
mollekopf: Is it save to assume that this is a valid email address here? Otherwise we'll crash below. | |||||
Done Inline ActionsWe validate the email in the controller. And as we don't want invalid emails in here, I think an error is what we actually want to happen on an invalid email. So, I would not change this. machniak: We validate the email in the controller. And as we don't want invalid emails in here, I think… | |||||
Not Done Inline ActionsSame as above. mollekopf: Same as above. |
Is it save to assume that this is a valid email address here? Otherwise we'll crash below.
Maybe just do the ?? null if it's not guaranteed that email is valid.