mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge company creation check
This commit is contained in:
parent
bcaad69d00
commit
77a2920538
@ -32,6 +32,10 @@ class AccountRepository
|
|||||||
public function create($firstName = '', $lastName = '', $email = '', $password = '', $company = false)
|
public function create($firstName = '', $lastName = '', $email = '', $password = '', $company = false)
|
||||||
{
|
{
|
||||||
if (! $company) {
|
if (! $company) {
|
||||||
|
if (Utils::isNinja()) {
|
||||||
|
$this->checkForSpammer();
|
||||||
|
}
|
||||||
|
|
||||||
$company = new Company();
|
$company = new Company();
|
||||||
$company->utm_source = Input::get('utm_source');
|
$company->utm_source = Input::get('utm_source');
|
||||||
$company->utm_medium = Input::get('utm_medium');
|
$company->utm_medium = Input::get('utm_medium');
|
||||||
@ -122,6 +126,23 @@ class AccountRepository
|
|||||||
return $account;
|
return $account;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function checkForSpammer()
|
||||||
|
{
|
||||||
|
$ip = Request::getClientIp();
|
||||||
|
$count = Account::whereIp($ip)->count();
|
||||||
|
|
||||||
|
if ($count > 1 && $errorEmail = env('ERROR_EMAIL')) {
|
||||||
|
\Mail::raw($ip, function ($message) use ($ip, $errorEmail) {
|
||||||
|
$message->to($errorEmail)
|
||||||
|
->from(CONTACT_EMAIL)
|
||||||
|
->subject('Duplicate company for IP: ' . $ip);
|
||||||
|
});
|
||||||
|
if ($count >= 5) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getSearchData($user)
|
public function getSearchData($user)
|
||||||
{
|
{
|
||||||
$data = $this->getAccountSearchData($user);
|
$data = $this->getAccountSearchData($user);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user