-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from ricom/feature/email-filter
Feature/email filter
- Loading branch information
Showing
6 changed files
with
155 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace App\Rules; | ||
|
||
use App\Services\EmailService; | ||
use Illuminate\Contracts\Validation\Rule; | ||
|
||
class EmailBlockList implements Rule | ||
{ | ||
|
||
|
||
private EmailService $emailService; | ||
/** | ||
* Create a new rule instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(EmailService $emailService) | ||
{ | ||
$this->emailService = $emailService; | ||
} | ||
|
||
/** | ||
* Determine if the validation rule passes. | ||
* | ||
* @param string $attribute | ||
* @param mixed $value | ||
* @return bool | ||
*/ | ||
public function passes($attribute, $value) | ||
{ | ||
return $this->emailService->checkBlockLists($value); | ||
} | ||
|
||
/** | ||
* Get the validation error message. | ||
* | ||
* @return string | ||
*/ | ||
public function message() | ||
{ | ||
return trans('validation.email_block_list'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
* defines which email addresses are allowed. | ||
* | ||
* The given strings are checked against the email a user chooses to register with. | ||
* Regex is supported. | ||
* | ||
* no entries results in allowing all emails which aren't blocked by the blacklist. | ||
* | ||
*/ | ||
"email_whitelist" => [ | ||
"^.*jade-hs.de$" | ||
], | ||
|
||
/* | ||
* defines which email addresses are permitted. | ||
* | ||
* The given strings are checked against the email a user chooses to register with and are allowed by the whitelist. | ||
* Regex is supported. | ||
*/ | ||
"email_blacklist" => [ | ||
] | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters