Refactor for account signups

This commit is contained in:
David Bomba 2021-05-26 10:37:59 +10:00
parent e254a9ad73
commit 0079e52b85
2 changed files with 6 additions and 3 deletions

View File

@ -142,7 +142,7 @@ class AccountController extends BaseController
*/ */
public function store(CreateAccountRequest $request) public function store(CreateAccountRequest $request)
{ {
$account = CreateAccount::dispatchNow($request->all()); $account = CreateAccount::dispatchNow($request->all(), $request->getClientIp());
if (! ($account instanceof Account)) { if (! ($account instanceof Account)) {
return $account; return $account;

View File

@ -42,9 +42,12 @@ class CreateAccount
protected $request; protected $request;
public function __construct(array $sp660339) protected $client_ip;
public function __construct(array $sp660339, $client_ip)
{ {
$this->request = $sp660339; $this->request = $sp660339;
$this->client_ip = $client_ip;
} }
public function handle() public function handle()
@ -113,7 +116,7 @@ class CreateAccount
private function processSettings($settings) private function processSettings($settings)
{ {
if(Ninja::isHosted() && Cache::get('currencies') && $data = unserialize(@file_get_contents('http://www.geoplugin.net/php.gp?ip=' . request()->getClientIp()))) if(Ninja::isHosted() && Cache::get('currencies') && $data = unserialize(@file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $this->client_ip)))
{ {
$currency_code = strtolower($data['geoplugin_currencyCode']); $currency_code = strtolower($data['geoplugin_currencyCode']);