1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

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);
}
$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'));
}

View File

@ -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;
}
}
}

View File

@ -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())

View File

@ -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) }}