Fix for lastpass issue

This commit is contained in:
Hillel Coren 2018-02-16 11:05:44 +02:00
parent 215736f8fd
commit 5ba715dedb
4 changed files with 33 additions and 24 deletions

View File

@ -138,7 +138,7 @@ class AccountController extends BaseController
Session::flash('warning', $message); 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')); return Redirect::to($redirectTo)->with('sign_up', Input::get('sign_up'));
} }

View File

@ -64,29 +64,30 @@ class AccountRepository
// Set default language/currency based on IP // Set default language/currency based on IP
if (\Cache::get('currencies')) { if (\Cache::get('currencies')) {
$data = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $account->ip)); if ($data = unserialize(@file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $account->ip))) {
$currencyCode = strtolower($data['geoplugin_currencyCode']); $currencyCode = strtolower($data['geoplugin_currencyCode']);
$countryCode = strtolower($data['geoplugin_countryCode']); $countryCode = strtolower($data['geoplugin_countryCode']);
$currency = \Cache::get('currencies')->filter(function ($item) use ($currencyCode) { $currency = \Cache::get('currencies')->filter(function ($item) use ($currencyCode) {
return strtolower($item->code) == $currencyCode; return strtolower($item->code) == $currencyCode;
})->first(); })->first();
if ($currency) { if ($currency) {
$account->currency_id = $currency->id; $account->currency_id = $currency->id;
} }
$country = \Cache::get('countries')->filter(function ($item) use ($countryCode) { $country = \Cache::get('countries')->filter(function ($item) use ($countryCode) {
return strtolower($item->iso_3166_2) == $countryCode || strtolower($item->iso_3166_3) == $countryCode; return strtolower($item->iso_3166_2) == $countryCode || strtolower($item->iso_3166_3) == $countryCode;
})->first(); })->first();
if ($country) { if ($country) {
$account->country_id = $country->id; $account->country_id = $country->id;
} }
$language = \Cache::get('languages')->filter(function ($item) use ($countryCode) { $language = \Cache::get('languages')->filter(function ($item) use ($countryCode) {
return strtolower($item->locale) == $countryCode; return strtolower($item->locale) == $countryCode;
})->first(); })->first();
if ($language) { if ($language) {
$account->language_id = $language->id; $account->language_id = $language->id;
}
} }
} }

View File

@ -250,7 +250,7 @@
@if (Auth::check()) @if (Auth::check())
@if (!Auth::user()->registered) @if (!Auth::user()->registered)
@if (!Auth::user()->confirmed) @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 @endif
@elseif (Utils::isNinjaProd() && (!Auth::user()->isPro() || Auth::user()->isTrial())) @elseif (Utils::isNinjaProd() && (!Auth::user()->isPro() || Auth::user()->isTrial()))
@if (Auth::user()->account->company->hasActivePromo()) @if (Auth::user()->account->company->hasActivePromo())

View File

@ -6,7 +6,7 @@
$('#signUpModal').on('shown.bs.modal', function () { $('#signUpModal').on('shown.bs.modal', function () {
trackEvent('/account', '/view_sign_up'); 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'); $('#new_password').attr('type', 'password');
$(['first_name','last_name','email','password']).each(function(i, field) { $(['first_name','last_name','email','password']).each(function(i, field) {
var $input = $('form.signUpForm #new_'+field); var $input = $('form.signUpForm #new_'+field);
@ -36,7 +36,11 @@
function showSignUp() { function showSignUp() {
$('#signUpModal').modal('show'); if (location.href.indexOf('/dashboard') == -1) {
location.href = "{{ url('/dashboard') }}?sign_up=true";
} else {
$('#signUpModal').modal('show');
}
} }
function hideSignUp() { function hideSignUp() {
@ -214,18 +218,22 @@
{!! Former::text('new_first_name') {!! Former::text('new_first_name')
->placeholder(trans('texts.first_name')) ->placeholder(trans('texts.first_name'))
->autocomplete('given-name') ->autocomplete('given-name')
->data_lpignore('true')
->label(' ') !!} ->label(' ') !!}
{!! Former::text('new_last_name') {!! Former::text('new_last_name')
->placeholder(trans('texts.last_name')) ->placeholder(trans('texts.last_name'))
->autocomplete('family-name') ->autocomplete('family-name')
->data_lpignore('true')
->label(' ') !!} ->label(' ') !!}
{!! Former::text('new_email') {!! Former::text('new_email')
->placeholder(trans('texts.email')) ->placeholder(trans('texts.email'))
->autocomplete('email') ->autocomplete('email')
->data_lpignore('true')
->label(' ') !!} ->label(' ') !!}
{!! Former::text('new_password') {!! Former::text('new_password')
->placeholder(trans('texts.password')) ->placeholder(trans('texts.password'))
->autocomplete('new-password') ->autocomplete('new-password')
->data_lpignore('true')
->label(' ') !!} ->label(' ') !!}
{{ Former::setOption('TwitterBootstrap3.labelWidths.large', 4) }} {{ Former::setOption('TwitterBootstrap3.labelWidths.large', 4) }}