diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index a7eb1ed53d9e..39015a4fa4d1 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -39,18 +39,8 @@ class AccountController extends \BaseController { if (!$user) { - $account = new Account; - $account->ip = Request::getClientIp(); - $account->account_key = str_random(RANDOM_KEY_LENGTH); - $account->save(); - - $random = str_random(RANDOM_KEY_LENGTH); - - $user = new User; - $user->password = $random; - $user->password_confirmation = $random; - $user->username = $random; - $account->users()->save($user); + $account = $this->accountRepo->create(); + $user = $account->users()->first(); Session::forget(RECENTLY_VIEWED); } diff --git a/app/filters.php b/app/filters.php index 18ed154ca049..8ad7d5ae42fd 100755 --- a/app/filters.php +++ b/app/filters.php @@ -23,7 +23,9 @@ App::before(function($request) if (Input::has('lang')) { - App::setLocale(Input::get('lang')); + $locale = Input::get('lang'); + Session::set(SESSION_LOCALE, $locale); + App::setLocale($locale); } else if (Auth::check()) { diff --git a/app/lang/de/texts.php b/app/lang/de/texts.php index 230c93a9118a..5c7b916f2860 100644 --- a/app/lang/de/texts.php +++ b/app/lang/de/texts.php @@ -293,5 +293,16 @@ return array( 'remove_logo' => ':link to remove the Invoice Ninja logo by joining the pro plan', 'remove_logo_link' => 'Click here', ], + + 'logout' => 'Log Out', + 'sign_up_to_save' => 'Sign up to save your work', + 'agree_to_terms' =>'I agree to the Invoice Ninja :terms', + 'terms_of_service' => 'Terms of Service', + 'email_taken' => 'The email address is already regiestered', + 'working' => 'Working', + 'success' => 'Success', + 'success_message' => 'You have succesfully registered. Please visit the link in the account confirmation email to verify your email address.', + 'erase_data' => 'This will permanently erase your data.', + ); diff --git a/app/lang/en/texts.php b/app/lang/en/texts.php index fb6572b95e60..4b61c609d9e8 100644 --- a/app/lang/en/texts.php +++ b/app/lang/en/texts.php @@ -294,4 +294,16 @@ return array( 'remove_logo_link' => 'Click here', ], + 'logout' => 'Log Out', + 'sign_up_to_save' => 'Sign up to save your work', + 'agree_to_terms' =>'I agree to the Invoice Ninja :terms', + 'terms_of_service' => 'Terms of Service', + 'email_taken' => 'The email address is already regiestered', + 'working' => 'Working', + 'success' => 'Success', + 'success_message' => 'You have succesfully registered. Please visit the link in the account confirmation email to verify your email address.', + 'erase_data' => 'This will permanently erase your data.', + + + ); diff --git a/app/lang/es/texts.php b/app/lang/es/texts.php index 7af80fbfcd55..94ed993b7497 100644 --- a/app/lang/es/texts.php +++ b/app/lang/es/texts.php @@ -292,6 +292,17 @@ return array( 'remove_logo' => ':link to remove the Invoice Ninja logo by joining the pro plan', 'remove_logo_link' => 'Click here', ], + + 'logout' => 'Log Out', + 'sign_up_to_save' => 'Sign up to save your work', + 'agree_to_terms' =>'I agree to the Invoice Ninja :terms', + 'terms_of_service' => 'Terms of Service', + 'email_taken' => 'The email address is already regiestered', + 'working' => 'Working', + 'success' => 'Success', + 'success_message' => 'You have succesfully registered. Please visit the link in the account confirmation email to verify your email address.', + 'erase_data' => 'This will permanently erase your data.', + ); diff --git a/app/lang/fr/texts.php b/app/lang/fr/texts.php index 4b34d5765d07..36b715f87c6f 100644 --- a/app/lang/fr/texts.php +++ b/app/lang/fr/texts.php @@ -293,6 +293,17 @@ return array( 'remove_logo' => ':link to remove the Invoice Ninja logo by joining the pro plan', 'remove_logo_link' => 'Click here', ], + + 'logout' => 'Log Out', + 'sign_up_to_save' => 'Sign up to save your work', + 'agree_to_terms' =>'I agree to the Invoice Ninja :terms', + 'terms_of_service' => 'Terms of Service', + 'email_taken' => 'The email address is already regiestered', + 'working' => 'Working', + 'success' => 'Success', + 'success_message' => 'You have succesfully registered. Please visit the link in the account confirmation email to verify your email address.', + 'erase_data' => 'This will permanently erase your data.', + ); diff --git a/app/lang/it/texts.php b/app/lang/it/texts.php index fecf29fea213..8a9cd04c04ab 100644 --- a/app/lang/it/texts.php +++ b/app/lang/it/texts.php @@ -294,6 +294,17 @@ return array( 'remove_logo_link' => 'Click here', ], + 'logout' => 'Log Out', + 'sign_up_to_save' => 'Sign up to save your work', + 'agree_to_terms' =>'I agree to the Invoice Ninja :terms', + 'terms_of_service' => 'Terms of Service', + 'email_taken' => 'The email address is already regiestered', + 'working' => 'Working', + 'success' => 'Success', + 'success_message' => 'You have succesfully registered. Please visit the link in the account confirmation email to verify your email address.', + 'erase_data' => 'This will permanently erase your data.', + + ); \ No newline at end of file diff --git a/app/lang/nl/texts.php b/app/lang/nl/texts.php index a1998eacbd9b..332a22e751e2 100644 --- a/app/lang/nl/texts.php +++ b/app/lang/nl/texts.php @@ -294,4 +294,16 @@ return array( 'remove_logo_link' => 'Klik hier', ], + 'logout' => 'Log Out', + 'sign_up_to_save' => 'Sign up to save your work', + 'agree_to_terms' =>'I agree to the Invoice Ninja :terms', + 'terms_of_service' => 'Terms of Service', + 'email_taken' => 'The email address is already regiestered', + 'working' => 'Working', + 'success' => 'Success', + 'success_message' => 'You have succesfully registered. Please visit the link in the account confirmation email to verify your email address.', + 'erase_data' => 'This will permanently erase your data.', + + + ); diff --git a/app/lang/pt_BR/texts.php b/app/lang/pt_BR/texts.php index cbe3f4fc68fb..d3ae05521d3a 100644 --- a/app/lang/pt_BR/texts.php +++ b/app/lang/pt_BR/texts.php @@ -282,5 +282,16 @@ return array( 'remove_logo_link' => 'Click here', ], + 'logout' => 'Log Out', + 'sign_up_to_save' => 'Sign up to save your work', + 'agree_to_terms' =>'I agree to the Invoice Ninja :terms', + 'terms_of_service' => 'Terms of Service', + 'email_taken' => 'The email address is already regiestered', + 'working' => 'Working', + 'success' => 'Success', + 'success_message' => 'You have succesfully registered. Please visit the link in the account confirmation email to verify your email address.', + 'erase_data' => 'This will permanently erase your data.', + + ); diff --git a/app/ninja/repositories/AccountRepository.php b/app/ninja/repositories/AccountRepository.php index 23bef9c54178..069814e83a5c 100755 --- a/app/ninja/repositories/AccountRepository.php +++ b/app/ninja/repositories/AccountRepository.php @@ -2,9 +2,44 @@ use Client; use Contact; +use Account; +use Request; +use Session; +use Language; +use User; class AccountRepository { + public function create() + { + $account = new Account; + $account->ip = Request::getClientIp(); + $account->account_key = str_random(RANDOM_KEY_LENGTH); + + if (Session::has(SESSION_LOCALE)) + { + $locale = Session::get(SESSION_LOCALE); + $language = Language::whereLocale($locale)->first(); + + if ($language) + { + $account->language_id = $language->id; + } + } + + $account->save(); + + $random = str_random(RANDOM_KEY_LENGTH); + + $user = new User; + $user->password = $random; + $user->password_confirmation = $random; + $user->username = $random; + $account->users()->save($user); + + return $account; + } + public function getSearchData() { $clients = \DB::table('clients') diff --git a/app/routes.php b/app/routes.php index 0ed60c8c673a..4a5f4a54cf84 100755 --- a/app/routes.php +++ b/app/routes.php @@ -113,20 +113,13 @@ HTML::macro('menu_link', function($type) { $Type = ucfirst($type); $Types = ucfirst($types); $class = ( Request::is($types) || Request::is('*'.$type.'*')) ? ' active' : ''; - $str= ''; + + return ''; }); HTML::macro('image_data', function($imagePath) { diff --git a/app/views/header.blade.php b/app/views/header.blade.php index 16d3744be515..f37fd99d17c6 100755 --- a/app/views/header.blade.php +++ b/app/views/header.blade.php @@ -108,11 +108,11 @@