mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-05 01:40:54 -05:00
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE.
|
||||
*
|
||||
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
|
||||
* The details is bundled with this project in the file LICENSE.txt.
|
||||
*
|
||||
* @project UNIT3D Community Edition
|
||||
*
|
||||
* @author HDVinnie <hdinnovations@protonmail.com>
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
||||
*/
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Helpers\EmailBlacklistUpdater;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class EmailBlacklistUpdate extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'auto:email-blacklist-update';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Update cache for email domains blacklist.';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$count = EmailBlacklistUpdater::update();
|
||||
|
||||
if ($count === false) {
|
||||
$this->warn('No domains retrieved. Check the email.blacklist.source key for validation config.');
|
||||
return;
|
||||
}
|
||||
if ($count === 0) {
|
||||
$this->info('Advice: Blacklist was retrieved from source but 0 domains were listed.');
|
||||
return;
|
||||
}
|
||||
$this->info("{$count} domains retrieved. Cache updated. You are good to go.");
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,7 @@ class Kernel extends ConsoleKernel
|
||||
$schedule->command('auto:recycle_claimed_torrent_requests')->daily();
|
||||
$schedule->command('auto:correct_history')->daily();
|
||||
$schedule->command('auto:sync_peers')->daily();
|
||||
$schedule->command('auto:email-blacklist-update')->monthly();
|
||||
//$schedule->command('backup:clean')->daily();
|
||||
//$schedule->command('backup:run')->daily();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE.
|
||||
*
|
||||
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
|
||||
* The details is bundled with this project in the file LICENSE.txt.
|
||||
*
|
||||
* @project UNIT3D Community Edition
|
||||
*
|
||||
* @author HDVinnie <hdinnovations@protonmail.com>
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
||||
*/
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
class EmailBlacklistUpdater
|
||||
{
|
||||
public static function update()
|
||||
{
|
||||
$url = config('email-blacklist.source');
|
||||
if ($url === null) {
|
||||
return false;
|
||||
}
|
||||
// Define parameters for the cache
|
||||
$key = config('email-blacklist.cache-key');
|
||||
$duration = Carbon::now()->addMonth();
|
||||
|
||||
$domains = json_decode(file_get_contents($url), true);
|
||||
$count = count($domains);
|
||||
|
||||
// Retrieve blacklisted domains
|
||||
cache()->put($key, $domains, $duration);
|
||||
|
||||
return $count;
|
||||
}
|
||||
}
|
||||
@@ -45,11 +45,11 @@ class ApplicationController extends Controller
|
||||
$application->email = $request->input('email');
|
||||
$application->referrer = $request->input('referrer');
|
||||
|
||||
if (config('email-white-blacklist.enabled') === 'allow') {
|
||||
if (config('email-blacklist.enabled') == true) {
|
||||
if (config('captcha.enabled') == false) {
|
||||
$v = validator($request->all(), [
|
||||
'type' => 'required',
|
||||
'email' => 'required|email|unique:invites|unique:users|unique:applications|email_list:allow',
|
||||
'email' => 'required|string|email|max:70|blacklist|unique:invites|unique:users|unique:applications',
|
||||
'referrer' => 'required',
|
||||
'images.*' => 'filled',
|
||||
'images' => 'min:2',
|
||||
@@ -59,30 +59,7 @@ class ApplicationController extends Controller
|
||||
} else {
|
||||
$v = validator($request->all(), [
|
||||
'type' => 'required',
|
||||
'email' => 'required|email|unique:invites|unique:users|unique:applications|email_list:allow',
|
||||
'referrer' => 'required',
|
||||
'images.*' => 'filled',
|
||||
'images' => 'min:2',
|
||||
'links.*' => 'filled',
|
||||
'links' => 'min:2',
|
||||
'captcha' => 'hiddencaptcha',
|
||||
]);
|
||||
}
|
||||
} elseif (config('email-white-blacklist.enabled') === 'block') {
|
||||
if (config('captcha.enabled') == false) {
|
||||
$v = validator($request->all(), [
|
||||
'type' => 'required',
|
||||
'email' => 'required|email|unique:invites|unique:users|unique:applications|email_list:block',
|
||||
'referrer' => 'required',
|
||||
'images.*' => 'filled',
|
||||
'images' => 'min:2',
|
||||
'links.*' => 'filled',
|
||||
'links' => 'min:2',
|
||||
]);
|
||||
} else {
|
||||
$v = validator($request->all(), [
|
||||
'type' => 'required',
|
||||
'email' => 'required|email|unique:invites|unique:users|unique:applications|email_list:block',
|
||||
'email' => 'required|string|email|max:70|blacklist|unique:invites|unique:users|unique:applications',
|
||||
'referrer' => 'required',
|
||||
'images.*' => 'filled',
|
||||
'images' => 'min:2',
|
||||
@@ -95,7 +72,7 @@ class ApplicationController extends Controller
|
||||
if (config('captcha.enabled') == false) {
|
||||
$v = validator($request->all(), [
|
||||
'type' => 'required',
|
||||
'email' => 'required|email|unique:invites|unique:users|unique:applications',
|
||||
'email' => 'required|string|email|max:70|unique:invites|unique:users|unique:applications',
|
||||
'referrer' => 'required',
|
||||
'images.*' => 'filled',
|
||||
'images' => 'min:2',
|
||||
@@ -105,7 +82,7 @@ class ApplicationController extends Controller
|
||||
} else {
|
||||
$v = validator($request->all(), [
|
||||
'type' => 'required',
|
||||
'email' => 'required|email|unique:invites|unique:users|unique:applications',
|
||||
'email' => 'required|string|email|max:70|unique:invites|unique:users|unique:applications',
|
||||
'referrer' => 'required',
|
||||
'images.*' => 'filled',
|
||||
'images' => 'min:2',
|
||||
|
||||
@@ -92,45 +92,36 @@ class RegisterController extends Controller
|
||||
$user->locale = config('app.locale');
|
||||
$user->group_id = $validating_group[0];
|
||||
|
||||
if (config('email-white-blacklist.enabled') === 'allow' && config('captcha.enabled') == true) {
|
||||
$v = validator($request->all(), [
|
||||
'username' => 'required|alpha_dash|min:3|max:20|unique:users',
|
||||
'email' => 'required|email|max:255|unique:users|email_list:allow', // Whitelist
|
||||
'password' => 'required|min:8',
|
||||
'captcha' => 'hiddencaptcha',
|
||||
]);
|
||||
} elseif (config('email-white-blacklist.enabled') === 'allow') {
|
||||
$v = validator($request->all(), [
|
||||
'username' => 'required|alpha_dash|min:3|max:20|unique:users',
|
||||
'email' => 'required|email|max:255|unique:users|email_list:allow', // Whitelist
|
||||
'password' => 'required|min:8',
|
||||
]);
|
||||
} elseif (config('email-white-blacklist.enabled') === 'block' && config('captcha.enabled') == true) {
|
||||
$v = validator($request->all(), [
|
||||
'username' => 'required|alpha_dash|min:3|max:20|unique:users',
|
||||
'email' => 'required|email|max:255|unique:users|email_list:block', // Blacklist
|
||||
'password' => 'required|min:8',
|
||||
'captcha' => 'hiddencaptcha',
|
||||
]);
|
||||
} elseif (config('email-white-blacklist.enabled') === 'block') {
|
||||
$v = validator($request->all(), [
|
||||
'username' => 'required|alpha_dash|min:3|max:20|unique:users',
|
||||
'email' => 'required|email|max:255|unique:users|email_list:block', // Blacklist
|
||||
'password' => 'required|min:8',
|
||||
]);
|
||||
} elseif (config('captcha.enabled') == true) {
|
||||
$v = validator($request->all(), [
|
||||
'username' => 'required|alpha_dash|min:3|max:20|unique:users',
|
||||
'email' => 'required|email|max:255|unique:users',
|
||||
'password' => 'required|min:8',
|
||||
'captcha' => 'hiddencaptcha',
|
||||
]);
|
||||
if (config('email-blacklist.enabled') == true) {
|
||||
if (config('captcha.enabled') == false) {
|
||||
$v = validator($request->all(), [
|
||||
'username' => 'required|alpha_dash|string|between:3,25|unique:users',
|
||||
'password' => 'required|string|between:8,16',
|
||||
'email' => 'required|string|email|max:70|blacklist|unique:users'
|
||||
]);
|
||||
} else {
|
||||
$v = validator($request->all(), [
|
||||
'username' => 'required|alpha_dash|string|between:3,25|unique:users',
|
||||
'password' => 'required|string|between:8,16',
|
||||
'email' => 'required|string|email|max:70|blacklist|unique:users',
|
||||
'captcha' => 'hiddencaptcha',
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
$v = validator($request->all(), [
|
||||
'username' => 'required|alpha_dash|min:3|max:20|unique:users', //Default
|
||||
'email' => 'required|email|max:255|unique:users',
|
||||
'password' => 'required|min:8',
|
||||
]);
|
||||
if (config('captcha.enabled') == false) {
|
||||
$v = validator($request->all(), [
|
||||
'username' => 'required|alpha_dash|string|between:3,25|unique:users',
|
||||
'password' => 'required|string|between:8,16',
|
||||
'email' => 'required|string|email|max:70|unique:users'
|
||||
]);
|
||||
} else {
|
||||
$v = validator($request->all(), [
|
||||
'username' => 'required|alpha_dash|string|between:3,25|unique:users',
|
||||
'password' => 'required|string|between:6,16',
|
||||
'email' => 'required|string|email|max:70|unique:users',
|
||||
'captcha' => 'hiddencaptcha',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($v->fails()) {
|
||||
@@ -185,17 +176,4 @@ class RegisterController extends Controller
|
||||
return redirect()->route('login')
|
||||
->withSuccess(trans('auth.register-thanks'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show Email Whitelist / Blacklist when not authenticated.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function publicEmailList()
|
||||
{
|
||||
$whitelist = config('email-white-blacklist.allow', []);
|
||||
$blacklist = config('email-white-blacklist.block', []);
|
||||
|
||||
return view('auth.public-emaillist', ['whitelist' => $whitelist, 'blacklist' => $blacklist]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,19 +108,14 @@ class InviteController extends Controller
|
||||
$invite->expires_on = $current->copy()->addDays(config('other.invite_expire'));
|
||||
$invite->custom = $request->input('message');
|
||||
|
||||
if (config('email-white-blacklist.enabled') === 'allow') {
|
||||
if (config('email-blacklist.enabled')) {
|
||||
$v = validator($invite->toArray(), [
|
||||
'email' => 'required|email|unique:users|email_list:allow', // Whitelist
|
||||
'custom' => 'required',
|
||||
]);
|
||||
} elseif (config('email-white-blacklist.enabled') === 'block') {
|
||||
$v = validator($invite->toArray(), [
|
||||
'email' => 'required|email|unique:users|email_list:block', // Blacklist
|
||||
'email' => 'required|string|email|max:70|blacklist|unique:users',
|
||||
'custom' => 'required',
|
||||
]);
|
||||
} else {
|
||||
$v = validator($invite->toArray(), [
|
||||
'email' => 'required|email|unique:users', // Default
|
||||
'email' => 'required|string|email|max:70|unique:users',
|
||||
'custom' => 'required',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -90,17 +90,4 @@ class PageController extends Controller
|
||||
{
|
||||
return view('page.aboutus');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show Email Whitelist / Blacklist Page.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function emailList()
|
||||
{
|
||||
$whitelist = config('email-white-blacklist.allow', []);
|
||||
$blacklist = config('email-white-blacklist.block', []);
|
||||
|
||||
return view('page.emaillist', ['whitelist' => $whitelist, 'blacklist' => $blacklist]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,19 +80,14 @@ class ApplicationController extends Controller
|
||||
$invite->expires_on = $current->copy()->addDays(config('other.invite_expire'));
|
||||
$invite->custom = $request->input('approve');
|
||||
|
||||
if (config('email-white-blacklist.enabled') === 'allow') {
|
||||
if (config('email-blacklist.enabled') == true) {
|
||||
$v = validator($request->all(), [
|
||||
'email' => 'required|email|unique:invites|unique:users|email_list:allow', // Whitelist
|
||||
'approve' => 'required',
|
||||
]);
|
||||
} elseif (config('email-white-blacklist.enabled') === 'block') {
|
||||
$v = validator($request->all(), [
|
||||
'email' => 'required|email|unique:invites|unique:users|email_list:block', // Blacklist
|
||||
'email' => 'required|string|email|max:70|blacklist|unique:users|unique:invites',
|
||||
'approve' => 'required',
|
||||
]);
|
||||
} else {
|
||||
$v = validator($request->all(), [
|
||||
'email' => 'required|email|unique:invites|unique:users', // Default
|
||||
'email' => 'required|string|email|max:70|unique:users|unique:invites',
|
||||
'approve' => 'required',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -352,17 +352,13 @@ class UserController extends Controller
|
||||
|
||||
abort_unless($request->user()->id == $user->id, 403);
|
||||
|
||||
if (config('email-white-blacklist.enabled') === 'allow') {
|
||||
if (config('email-blacklist.enabled') == true) {
|
||||
$v = validator($request->all(), [
|
||||
'email' => 'required|email|unique:users|email_list:allow', // Whitelist
|
||||
]);
|
||||
} elseif (config('email-white-blacklist.enabled') === 'block') {
|
||||
$v = validator($request->all(), [
|
||||
'email' => 'required|email|unique:users|email_list:block', // Blacklist
|
||||
'email' => 'required|string|email|max:70|blacklist|unique:users'
|
||||
]);
|
||||
} else {
|
||||
$v = validator($request->all(), [
|
||||
'email' => 'required|email|unique:users', // Default
|
||||
'email' => 'required|string|email|max:70|unique:users'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,9 +70,6 @@ class AppServiceProvider extends ServiceProvider
|
||||
// Torrent Observer For Cache
|
||||
Torrent::observe(TorrentObserver::class);
|
||||
|
||||
// Custom validation for the email whitelist/blacklist
|
||||
validator()->extend('email_list', 'App\Validators\EmailValidator@validateEmailList');
|
||||
|
||||
// Share $footer_pages across all views
|
||||
view()->composer('*', function (View $view) {
|
||||
$footer_pages = cache()->remember('cached-pages', 3_600, fn () => Page::select(['id', 'name', 'slug', 'created_at'])->take(6)->get());
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE.
|
||||
*
|
||||
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
|
||||
* The details is bundled with this project in the file LICENSE.txt.
|
||||
*
|
||||
* @project UNIT3D Community Edition
|
||||
*
|
||||
* @author HDVinnie <hdinnovations@protonmail.com>
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
||||
*/
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class EmailBlacklistServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
// Add custom validation rules
|
||||
Validator::extend("blacklist", "App\Validators\EmailBlacklistValidator@validate");
|
||||
|
||||
// Add custom validation messages
|
||||
Validator::replacer("blacklist", "App\Validators\EmailBlacklistValidator@message");
|
||||
}
|
||||
}
|
||||
@@ -13,27 +13,86 @@
|
||||
|
||||
namespace App\Validators;
|
||||
|
||||
class EmailValidator
|
||||
use App\Helpers\EmailBlacklistUpdater;
|
||||
use Illuminate\Support\Str;
|
||||
use Psr\SimpleCache\InvalidArgumentException;
|
||||
|
||||
class EmailBlacklistValidator
|
||||
{
|
||||
public function validateEmailList($attribute, $value, $parameters, $validator)
|
||||
/**
|
||||
* Array of blacklisted domains
|
||||
*/
|
||||
private $domains = [];
|
||||
|
||||
/**
|
||||
* Generate the error message on validation failure
|
||||
* @param $message
|
||||
* @param $attribute
|
||||
* @param $rule
|
||||
* @param $parameters
|
||||
* @return string
|
||||
*/
|
||||
public function message($message, $attribute, $rule, $parameters)
|
||||
{
|
||||
$domain = substr(strrchr($value, '@'), 1);
|
||||
switch ($parameters[0]) {
|
||||
case 'block':
|
||||
$domain_list = config('email-white-blacklist.block');
|
||||
return "{$attribute} domain is not allowed. Throwaway email providers are blacklisted.";
|
||||
}
|
||||
|
||||
return ! in_array($domain, $domain_list);
|
||||
/**
|
||||
* Execute the validation routine.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param string $value
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return bool.
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function validate($attribute, $value, $parameters)
|
||||
{
|
||||
// Load blacklisted domains
|
||||
$this->refresh();
|
||||
|
||||
break;
|
||||
case 'allow':
|
||||
$domain_list = config('email-white-blacklist.allow');
|
||||
// Extract domain from supplied email address
|
||||
$domain = Str::after(strtolower($value), "@");
|
||||
|
||||
return in_array($domain, $domain_list);
|
||||
// Run validation check
|
||||
return ! in_array($domain, $this->domains);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
// code...
|
||||
break;
|
||||
/**
|
||||
* Retrive latest selection of blacklisted domains and cache them
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function refresh()
|
||||
{
|
||||
$this->shouldUpdate();
|
||||
$this->domains = cache()->get(config('email-blacklist.cache-key'));
|
||||
$this->appendCustomDomains();
|
||||
}
|
||||
|
||||
protected function shouldUpdate()
|
||||
{
|
||||
$autoupdate = config('email-blacklist.auto-update');
|
||||
try {
|
||||
if ($autoupdate && ! cache()->has(config('email-blacklist.cache-key'))) {
|
||||
EmailBlacklistUpdater::update();
|
||||
}
|
||||
} catch (InvalidArgumentException $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function appendCustomDomains()
|
||||
{
|
||||
$append_list = config('email-blacklist.append');
|
||||
if ($append_list === null) {
|
||||
return;
|
||||
}
|
||||
$append_domains = explode('|', strtolower($append_list));
|
||||
$this->domains = array_merge($this->domains, $append_domains);
|
||||
}
|
||||
}
|
||||
@@ -189,6 +189,7 @@ return [
|
||||
App\Providers\AppServiceProvider::class,
|
||||
App\Providers\AuthServiceProvider::class,
|
||||
App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\EmailBlacklistServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE.
|
||||
*
|
||||
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
|
||||
* The details is bundled with this project in the file LICENSE.txt.
|
||||
*
|
||||
* @project UNIT3D Community Edition
|
||||
*
|
||||
* @author HDVinnie <hdinnovations@protonmail.com>
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
||||
*/
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Email Domain Blackist Validation
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The email domain blacklist validation rule uses a remote or local source
|
||||
| to get updated and also allows to specify a custom append list.
|
||||
|
|
||||
| enabled: true|false
|
||||
|
|
||||
| source: string|null
|
||||
| You may specify the preferred URL or file path to update the
|
||||
| blacklist.
|
||||
| Keep null if you don't want to use a remote source.
|
||||
| Default: "https://raw.githubusercontent.com/ivolo/disposable-email-domains/master/index.json"
|
||||
|
|
||||
| cache-key: string|null
|
||||
| You may change the cache key for the sourced blacklist.
|
||||
| Keep null if you want to use the default value.
|
||||
|
|
||||
| auto-update: true|false
|
||||
| Specify if should automatically get source when cache is empty.
|
||||
| ADVICE: This may slow down the first request upon validation.
|
||||
| Default: false
|
||||
|
|
||||
| append: string|null
|
||||
| You may a string of pipe | separated domains list.
|
||||
| Keep null if you don't want to append custom domains.
|
||||
| Example: "example.com|example.net|foobar.com".
|
||||
|
|
||||
*/
|
||||
'enabled' => true,
|
||||
'source' => 'https://raw.githubusercontent.com/ivolo/disposable-email-domains/master/index.json',
|
||||
'cache-key' => 'email.domains.blacklist',
|
||||
'auto-update' => true,
|
||||
'append' => null,
|
||||
];
|
||||
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE.
|
||||
*
|
||||
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
|
||||
* The details is bundled with this project in the file LICENSE.txt.
|
||||
*
|
||||
* @project UNIT3D Community Edition
|
||||
*
|
||||
* @author HDVinnie <hdinnovations@protonmail.com>
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
||||
*/
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| whitelist = allow / blacklist = block / disabled = null
|
||||
|
|
||||
*/
|
||||
|
||||
'enabled' => 'null',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Blacklist
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Domains you want to block e.g mailinator.com
|
||||
|
|
||||
*/
|
||||
'block' => [
|
||||
//
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Whitelist
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Domains you want to allow e.g gmail.com
|
||||
|
|
||||
*/
|
||||
'allow' => [
|
||||
//
|
||||
],
|
||||
];
|
||||
@@ -1,100 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="no-js" lang="{{ config('app.locale') }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Email list - {{ config('other.title') }}</title>
|
||||
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="Email list">
|
||||
<meta property="og:title" content="@lang('auth.email')">
|
||||
<meta property="og:site_name" content="{{ config('other.title') }}">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="{{ config('unit3d.powered-by') }}">
|
||||
<meta property="og:url" content="{{ url('/') }}">
|
||||
<meta property="og:locale" content="{{ config('app.locale') }}">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<link rel="stylesheet" href="{{ mix('css/app.css') }}" integrity="{{ Sri::hash('css/app.css') }}"
|
||||
crossorigin="anonymous">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container box">
|
||||
<div class="col-md-12 page">
|
||||
|
||||
@if (config('email-white-blacklist.enabled') == null)
|
||||
<div class="alert alert-info" id="alert1">
|
||||
<div class="text-center">
|
||||
<span>
|
||||
{{ config('other.title') }} @lang('common.email-list-notactive')
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
|
||||
@if (config('email-white-blacklist.enabled') == 'allow')
|
||||
<div class="header gradient green">
|
||||
<div class="inner_content">
|
||||
<div class="page-title">
|
||||
<h1>{{ config('other.title') }} @lang('common.email-whitelist')</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@if (config('email-white-blacklist.enabled') == 'block')
|
||||
<div class="header gradient red">
|
||||
<div class="inner_content">
|
||||
<div class="page-title">
|
||||
<h1>{{ config('other.title') }} @lang('common.email-blacklist')</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="alert alert-info" id="alert1">
|
||||
<div class="text-center">
|
||||
@if (config('email-white-blacklist.enabled') == 'allow')
|
||||
<span>
|
||||
@lang('page.email-whitelist-desc', ['title' => config('other.title')])
|
||||
</span>
|
||||
@endif
|
||||
@if (config('email-white-blacklist.enabled') == 'block')
|
||||
<span>
|
||||
@lang('page.email-blacklist-desc', ['title' => config('other.title')])
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (config('email-white-blacklist.enabled') == 'allow')
|
||||
<div class="row black-list">
|
||||
@foreach ($whitelist as $w)
|
||||
<div class="col-xs-6 col-sm-4 col-md-3">
|
||||
<div class="text-center black-item">
|
||||
<span class="text-bold">{{ $w }}</span>
|
||||
<h4>@lang('page.whitelist-emaildomain')</h4>
|
||||
<i class="fal fa-check text-green black-icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (config('email-white-blacklist.enabled') == 'block')
|
||||
<div class="row black-list">
|
||||
@foreach ($blacklist as $b)
|
||||
<div class="col-xs-6 col-sm-4 col-md-3">
|
||||
<div class="text-center black-item">
|
||||
<span class="text-bold">{{ $b }}</span>
|
||||
<h4>@lang('page.blacklist-emaildomain')</h4>
|
||||
<i class="fal fa-ban text-red black-icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,96 +0,0 @@
|
||||
@extends('layout.default')
|
||||
|
||||
@section('breadcrumb')
|
||||
<li>
|
||||
<a href="{{ route('emaillist') }}" itemprop="url" class="l-breadcrumb-item-link">
|
||||
<span itemprop="title" class="l-breadcrumb-item-link-title">
|
||||
@if (config('email-white-blacklist.enabled') == 'allow')
|
||||
{{ config('other.title') }} @lang('common.email-whitelist')
|
||||
@endif
|
||||
@if (config('email-white-blacklist.enabled') == 'block')
|
||||
{{ config('other.title') }} @lang('common.email-blacklist')
|
||||
@endif
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="container box">
|
||||
<div class="col-md-12 page">
|
||||
|
||||
@if (config('email-white-blacklist.enabled') == null)
|
||||
<div class="alert alert-info" id="alert1">
|
||||
<div class="text-center">
|
||||
<span>
|
||||
{{ config('other.title') }} @lang('common.email-list-notactive')
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
|
||||
@if (config('email-white-blacklist.enabled') == 'allow')
|
||||
<div class="header gradient green">
|
||||
<div class="inner_content">
|
||||
<div class="page-title">
|
||||
<h1>{{ config('other.title') }} @lang('common.email-whitelist')</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@if (config('email-white-blacklist.enabled') == 'block')
|
||||
<div class="header gradient red">
|
||||
<div class="inner_content">
|
||||
<div class="page-title">
|
||||
<h1>{{ config('other.title') }} @lang('common.email-blacklist')</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="alert alert-info" id="alert1">
|
||||
<div class="text-center">
|
||||
@if (config('email-white-blacklist.enabled') == 'allow')
|
||||
<span>
|
||||
@lang('page.email-whitelist-desc', ['title' => config('other.title')])
|
||||
</span>
|
||||
@endif
|
||||
@if (config('email-white-blacklist.enabled') == 'block')
|
||||
<span>
|
||||
@lang('page.email-blacklist-desc', ['title' => config('other.title')])
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (config('email-white-blacklist.enabled') == 'allow')
|
||||
<div class="row black-list">
|
||||
@foreach ($whitelist as $w)
|
||||
<div class="col-xs-6 col-sm-4 col-md-3">
|
||||
<div class="text-center black-item">
|
||||
<span class="text-bold">{{ $w }}</span>
|
||||
<h4>@lang('page.whitelist-emaildomain')</h4>
|
||||
<i class="fal fa-check text-green black-icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (config('email-white-blacklist.enabled') == 'block')
|
||||
<div class="row black-list">
|
||||
@foreach ($blacklist as $b)
|
||||
<div class="col-xs-6 col-sm-4 col-md-3">
|
||||
<div class="text-center black-item">
|
||||
<span class="text-bold">{{ $b }}</span>
|
||||
<h4>@lang('page.blacklist-emaildomain')</h4>
|
||||
<i class="fal fa-ban text-red black-icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -51,12 +51,6 @@
|
||||
<li><a href="{{ route('staff') }}">@lang('common.staff')</a></li>
|
||||
<li><a href="{{ route('internal') }}">@lang('common.internal')</a></li>
|
||||
<li><a href="{{ route('blacklist') }}">@lang('common.blacklist')</a></li>
|
||||
@if (config('email-white-blacklist.enabled') == 'allow')
|
||||
<li><a href="{{ route('emaillist') }}">@lang('common.email-whitelist')</a></li>
|
||||
@endif
|
||||
@if (config('email-white-blacklist.enabled') == 'block')
|
||||
<li><a href="{{ route('emaillist') }}">@lang('common.email-blacklist')</a></li>
|
||||
@endif
|
||||
<li><a href="{{ route('about') }}">@lang('common.about')</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -54,9 +54,6 @@ Route::group(['middleware' => 'language'], function () {
|
||||
// Registration
|
||||
Route::get('/register/{code?}', 'Auth\RegisterController@registrationForm')->name('registrationForm');
|
||||
Route::post('/register/{code?}', 'Auth\RegisterController@register')->name('register');
|
||||
|
||||
// Public email white/blacklists
|
||||
Route::get('emaildomains', 'Auth\RegisterController@publicEmailList')->name('public.email');
|
||||
});
|
||||
|
||||
/*
|
||||
@@ -179,7 +176,6 @@ Route::group(['middleware' => 'language'], function () {
|
||||
Route::get('/internal', 'PageController@internal')->name('internal');
|
||||
Route::get('/blacklist', 'PageController@blacklist')->name('blacklist');
|
||||
Route::get('/aboutus', 'PageController@about')->name('about');
|
||||
Route::get('/emaillist', 'PageController@emailList')->name('emaillist');
|
||||
Route::get('/{id}', 'PageController@show')->where('id', '[0-9]+')->name('pages.show');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user