diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 3e3bace983..da78262f88 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -138,7 +138,7 @@ class AccountController extends BaseController Session::flash('warning', $message); } - $redirectTo = Input::get('redirect_to') ? SITE_URL . '/' . ltrim(Input::get('redirect_to'), '/') : 'invoices/create'; + $redirectTo = Input::get('redirect_to') ? SITE_URL . '/' . ltrim(Input::get('redirect_to'), '/') : 'dashboard'; return Redirect::to($redirectTo)->with('sign_up', Input::get('sign_up')); } diff --git a/app/Ninja/Repositories/AccountRepository.php b/app/Ninja/Repositories/AccountRepository.php index 2f800c02d3..cacfdd2cdf 100644 --- a/app/Ninja/Repositories/AccountRepository.php +++ b/app/Ninja/Repositories/AccountRepository.php @@ -64,29 +64,30 @@ class AccountRepository // Set default language/currency based on IP if (\Cache::get('currencies')) { - $data = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $account->ip)); - $currencyCode = strtolower($data['geoplugin_currencyCode']); - $countryCode = strtolower($data['geoplugin_countryCode']); + if ($data = unserialize(@file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $account->ip))) { + $currencyCode = strtolower($data['geoplugin_currencyCode']); + $countryCode = strtolower($data['geoplugin_countryCode']); - $currency = \Cache::get('currencies')->filter(function ($item) use ($currencyCode) { - return strtolower($item->code) == $currencyCode; - })->first(); - if ($currency) { - $account->currency_id = $currency->id; - } + $currency = \Cache::get('currencies')->filter(function ($item) use ($currencyCode) { + return strtolower($item->code) == $currencyCode; + })->first(); + if ($currency) { + $account->currency_id = $currency->id; + } - $country = \Cache::get('countries')->filter(function ($item) use ($countryCode) { - return strtolower($item->iso_3166_2) == $countryCode || strtolower($item->iso_3166_3) == $countryCode; - })->first(); - if ($country) { - $account->country_id = $country->id; - } + $country = \Cache::get('countries')->filter(function ($item) use ($countryCode) { + return strtolower($item->iso_3166_2) == $countryCode || strtolower($item->iso_3166_3) == $countryCode; + })->first(); + if ($country) { + $account->country_id = $country->id; + } - $language = \Cache::get('languages')->filter(function ($item) use ($countryCode) { - return strtolower($item->locale) == $countryCode; - })->first(); - if ($language) { - $account->language_id = $language->id; + $language = \Cache::get('languages')->filter(function ($item) use ($countryCode) { + return strtolower($item->locale) == $countryCode; + })->first(); + if ($language) { + $account->language_id = $language->id; + } } } diff --git a/resources/views/header.blade.php b/resources/views/header.blade.php index a3108865eb..a971b39f32 100644 --- a/resources/views/header.blade.php +++ b/resources/views/header.blade.php @@ -250,7 +250,7 @@ @if (Auth::check()) @if (!Auth::user()->registered) @if (!Auth::user()->confirmed) - {!! Button::success(trans('texts.sign_up'))->withAttributes(array('id' => 'signUpButton', 'data-toggle'=>'modal', 'data-target'=>'#signUpModal', 'style' => 'max-width:100px;;overflow:hidden'))->small() !!}   + {!! Button::success(trans('texts.sign_up'))->withAttributes(array('id' => 'signUpButton', 'onclick' => 'showSignUp()', 'style' => 'max-width:100px;;overflow:hidden'))->small() !!}   @endif @elseif (Utils::isNinjaProd() && (!Auth::user()->isPro() || Auth::user()->isTrial())) @if (Auth::user()->account->company->hasActivePromo()) diff --git a/resources/views/partials/sign_up.blade.php b/resources/views/partials/sign_up.blade.php index 54db50b3d3..6fe25dd0c7 100644 --- a/resources/views/partials/sign_up.blade.php +++ b/resources/views/partials/sign_up.blade.php @@ -6,7 +6,7 @@ $('#signUpModal').on('shown.bs.modal', function () { trackEvent('/account', '/view_sign_up'); - // change the type after page load to prevent errors in Chrome console + // change the type after page load to prevent errors in Chrome console $('#new_password').attr('type', 'password'); $(['first_name','last_name','email','password']).each(function(i, field) { var $input = $('form.signUpForm #new_'+field); @@ -36,7 +36,11 @@ function showSignUp() { - $('#signUpModal').modal('show'); + if (location.href.indexOf('/dashboard') == -1) { + location.href = "{{ url('/dashboard') }}?sign_up=true"; + } else { + $('#signUpModal').modal('show'); + } } function hideSignUp() { @@ -214,18 +218,22 @@ {!! Former::text('new_first_name') ->placeholder(trans('texts.first_name')) ->autocomplete('given-name') + ->data_lpignore('true') ->label(' ') !!} {!! Former::text('new_last_name') ->placeholder(trans('texts.last_name')) ->autocomplete('family-name') + ->data_lpignore('true') ->label(' ') !!} {!! Former::text('new_email') ->placeholder(trans('texts.email')) ->autocomplete('email') + ->data_lpignore('true') ->label(' ') !!} {!! Former::text('new_password') ->placeholder(trans('texts.password')) ->autocomplete('new-password') + ->data_lpignore('true') ->label(' ') !!} {{ Former::setOption('TwitterBootstrap3.labelWidths.large', 4) }}