mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-20 19:35:16 +00:00
Can block certain domains from registering, such as ten-minute-mail services. Two example domains provided in configuration.
This commit is contained in:
@@ -14,6 +14,7 @@ use Session;
|
|||||||
use Twig;
|
use Twig;
|
||||||
use Validator;
|
use Validator;
|
||||||
use Log;
|
use Log;
|
||||||
|
use Config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AuthController
|
* Class AuthController
|
||||||
@@ -89,7 +90,7 @@ class AuthController extends Controller
|
|||||||
if (!is_null($foundUser)) {
|
if (!is_null($foundUser)) {
|
||||||
// if it exists, show message:
|
// if it exists, show message:
|
||||||
$code = $foundUser->blocked_code;
|
$code = $foundUser->blocked_code;
|
||||||
if(strlen($code) == 0) {
|
if (strlen($code) == 0) {
|
||||||
$code = 'general_blocked';
|
$code = 'general_blocked';
|
||||||
}
|
}
|
||||||
$message = trans('firefly.' . $code . '_error', ['email' => $credentials['email']]);
|
$message = trans('firefly.' . $code . '_error', ['email' => $credentials['email']]);
|
||||||
@@ -160,9 +161,20 @@ class AuthController extends Controller
|
|||||||
}
|
}
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
|
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
$data['password'] = bcrypt($data['password']);
|
$data['password'] = bcrypt($data['password']);
|
||||||
|
|
||||||
|
// is user email domain blocked?
|
||||||
|
$parts = explode('@', $data['email']);
|
||||||
|
if (isset($parts[1]) && in_array($parts[1], Config::get('mail.blocked_domains'))) {
|
||||||
|
|
||||||
|
$validator->getMessageBag()->add('email', trans('validation.invalid_domain'));
|
||||||
|
$this->throwValidationException(
|
||||||
|
$request, $validator
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Auth::login($this->create($data));
|
Auth::login($this->create($data));
|
||||||
|
|
||||||
// get the email address
|
// get the email address
|
||||||
|
@@ -15,6 +15,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
'blocked_domains' => ['trbvm.com', 'example.com'],
|
||||||
'driver' => env('EMAIL_DRIVER', 'smtp'),
|
'driver' => env('EMAIL_DRIVER', 'smtp'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -13,6 +13,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
'invalid_domain' => 'Cannot register from this domain.',
|
||||||
'file_already_attached' => 'Uploaded file ":name" is already attached to this object.',
|
'file_already_attached' => 'Uploaded file ":name" is already attached to this object.',
|
||||||
'file_attached' => 'Succesfully uploaded file ":name".',
|
'file_attached' => 'Succesfully uploaded file ":name".',
|
||||||
'file_invalid_mime' => 'File ":name" is of type ":mime" which is not accepted as a new upload.',
|
'file_invalid_mime' => 'File ":name" is of type ":mime" which is not accepted as a new upload.',
|
||||||
|
@@ -13,6 +13,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
'invalid_domain' => 'Kan niet registereren vanaf dit domein.',
|
||||||
'file_already_attached' => 'Het geuploade bestand ":name" is al gelinkt aan deze transactie.',
|
'file_already_attached' => 'Het geuploade bestand ":name" is al gelinkt aan deze transactie.',
|
||||||
'file_attached' => 'Bestand met naam ":name" is met succes geuploaded.',
|
'file_attached' => 'Bestand met naam ":name" is met succes geuploaded.',
|
||||||
'file_invalid_mime' => 'Bestand ":name" is van het type ":mime", en die kan je niet uploaden.',
|
'file_invalid_mime' => 'Bestand ":name" is van het type ":mime", en die kan je niet uploaden.',
|
||||||
|
Reference in New Issue
Block a user