Page MenuHomePhorge

SignupExternalEmail.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

SignupExternalEmail.php

<?php
namespace App\Rules;
use App\SignupCode;
class SignupExternalEmail extends ExternalEmail
{
/**
* {@inheritDoc}
*/
public function passes($attribute, $email): bool
{
if (!parent::passes($attribute, $email)) {
return false;
}
// Check the max length, according to the database column length
if (strlen($email) > 191) {
$this->message = \trans('validation.emailinvalid');
return false;
}
// Don't allow multiple open registrations against the same email address
if (($limit = \config('app.signup.email_limit')) > 0) {
$signups = SignupCode::where('email', $email)
->where('expires_at', '>', \Carbon\Carbon::now());
if ($signups->count() >= $limit) {
// @kanarip: this is deliberately an "email invalid" message
$this->message = \trans('validation.emailinvalid');
return false;
}
}
// Don't allow multiple open registrations against the same source ip address
if (($limit = \config('app.signup.ip_limit')) > 0) {
$signups = SignupCode::where('ip_address', request()->ip())
->where('expires_at', '>', \Carbon\Carbon::now());
if ($signups->count() >= $limit) {
// @kanarip: this is deliberately an "email invalid" message
$this->message = \trans('validation.emailinvalid');
return false;
}
}
return true;
}
}

File Metadata

Mime Type
text/x-php
Expires
Thu, Jul 9, 1:54 AM (6 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1052529
Default Alt Text
SignupExternalEmail.php (1 KB)

Event Timeline