Last active
March 28, 2025 04:58
-
-
Save navt/42b29a7bd8e0beb2625c3662b6a869ce to your computer and use it in GitHub Desktop.
Проверка MX записи для домена почты при регистрации
This file contains hidden or 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
| <?php | |
| /* /system/controllers/auth/hooks/registration_validation.php */ | |
| class onAuthRegistrationValidation extends cmsAction { | |
| public function run($data){ | |
| list($errors, $user) = $data; | |
| if ($errors != []) { | |
| return $data; | |
| } | |
| list(, $domain) = explode('@', $user['email']); | |
| if (checkdnsrr($domain, 'MX') === false) { | |
| $errors['email'] = "MX запись для {$domain} не найдена."; | |
| return [$errors, $user]; | |
| } | |
| return $data; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment