├── LICENSE.md ├── README.md ├── composer.json ├── extend.php ├── locale └── en.yml └── phpstan.neon /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 FriendsOfFlarum 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Disposable Emails by FriendsOfFlarum 2 | 3 | ![License](https://img.shields.io/badge/license-MIT-blue.svg) [![Latest Stable Version](https://img.shields.io/packagist/v/fof/disposable-emails.svg)](https://packagist.org/packages/fof/disposable-emails) 4 | 5 | A [Flarum](http://flarum.org) extension. Prevent users from signing up with disposable emails. 6 | 7 | The full list of disposable email domains blocked by this extension can be found [here](https://github.com/FGRibreau/mailchecker/blob/master/list.txt) 8 | 9 |
10 | Screenshots 11 | 12 | sign up modal 13 | edit user modal 14 |
15 | 16 | 17 | 18 | 19 | ### Installation 20 | 21 | Install with composer: 22 | 23 | ```sh 24 | composer require fof/disposable-emails:"*" 25 | ``` 26 | 27 | ### Updating 28 | 29 | ```sh 30 | composer update fof/disposable-emails 31 | ``` 32 | 33 | ### Links 34 | 35 | [](https://opencollective.com/fof/donate) 36 | [](https://patreon.com/datitisev) 37 | 38 | - [Packagist](https://packagist.org/packages/fof/disposable-emails) 39 | - [GitHub](https://github.com/FriendsOfFlarum/disposable-emails) 40 | 41 | An extension by [FriendsOfFlarum](https://github.com/FriendsOfFlarum). 42 | 43 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fof/disposable-emails", 3 | "description": "Prevent users from signing up with disposable emails", 4 | "keywords": [ 5 | "flarum" 6 | ], 7 | "type": "flarum-extension", 8 | "license": "MIT", 9 | "support": { 10 | "issues": "https://github.com/FriendsOfFlarum/disposabile-emails/issues", 11 | "source": "https://github.com/FriendsOfFlarum/disposable-emails", 12 | "forum": "https://discuss.flarum.org/d/20457" 13 | }, 14 | "homepage": "https://friendsofflarum.org", 15 | "funding": [ 16 | { 17 | "type": "website", 18 | "url": "https://opencollective.com/fof/donate" 19 | } 20 | ], 21 | "require": { 22 | "flarum/core": "^1.0.0", 23 | "fgribreau/mailchecker": "^4.0.7" 24 | }, 25 | "authors": [ 26 | { 27 | "name": "David Sevilla Martín", 28 | "email": "david.s@redevs.org", 29 | "role": "Developer" 30 | } 31 | ], 32 | "autoload": { 33 | "psr-4": { 34 | "FoF\\DisposableEmails\\": "src/" 35 | } 36 | }, 37 | "extra": { 38 | "flarum-extension": { 39 | "title": "FoF Disposable Emails", 40 | "category": "feature", 41 | "icon": { 42 | "name": "fas fa-user-times", 43 | "backgroundColor": "#e74c3c", 44 | "color": "#fff" 45 | } 46 | }, 47 | "flagrow": { 48 | "discuss": "https://discuss.flarum.org/d/20457" 49 | }, 50 | "flarum-cli": { 51 | "modules": { 52 | "githubActions": true 53 | } 54 | } 55 | }, 56 | "require-dev": { 57 | "flarum/phpstan": "*" 58 | }, 59 | "scripts": { 60 | "analyse:phpstan": "phpstan analyse", 61 | "clear-cache:phpstan": "phpstan clear-result-cache" 62 | }, 63 | "scripts-descriptions": { 64 | "analyse:phpstan": "Run static analysis" 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /extend.php: -------------------------------------------------------------------------------- 1 | listen(Saving::class, function (Saving $event) { 25 | $email = Arr::get($event->data, 'attributes.email'); 26 | 27 | if (!empty($email) && !MailChecker::isValid($email)) { 28 | throw new ValidationException([ 29 | resolve('translator')->trans('fof-email-checker.error.disposable_email_message'), 30 | ]); 31 | } 32 | }), 33 | ]; 34 | -------------------------------------------------------------------------------- /locale/en.yml: -------------------------------------------------------------------------------- 1 | fof-email-checker: 2 | error: 3 | disposable_email_message: You may not use a disposable email. -------------------------------------------------------------------------------- /phpstan.neon: -------------------------------------------------------------------------------- 1 | includes: 2 | - vendor/flarum/phpstan/extension.neon 3 | 4 | parameters: 5 | # The level will be increased in Flarum 2.0 6 | level: 5 7 | paths: 8 | - extend.php 9 | excludePaths: 10 | - *.blade.php 11 | checkMissingIterableValueType: false 12 | databaseMigrationsPath: ['migrations'] 13 | --------------------------------------------------------------------------------