mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #5047 from turbo124/v5-develop
Integrate phantom js secret default value into config
This commit is contained in:
commit
403b91f69b
@ -212,7 +212,7 @@ class SetupController extends Controller
|
||||
public function checkPdf(Request $request)
|
||||
{
|
||||
try {
|
||||
if (config('ninja.phantomjs_key')) {
|
||||
if (config('ninja.phantomjs_pdf_generation')) {
|
||||
return $this->testPhantom();
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ class SetupController extends Controller
|
||||
private function testPhantom()
|
||||
{
|
||||
try {
|
||||
$key = config('ninja.phantomjs_key');
|
||||
$key = config('ninja.phantomjs_pdf_generation');
|
||||
$url = 'https://www.invoiceninja.org/';
|
||||
|
||||
$phantom_url = "https://phantomjscloud.com/api/browser/v2/{$key}/?request=%7Burl:%22{$url}%22,renderType:%22pdf%22%7D";
|
||||
|
@ -466,6 +466,9 @@ class UserController extends BaseController
|
||||
*/
|
||||
public function destroy(DestroyUserRequest $request, User $user)
|
||||
{
|
||||
if($user->isOwner())
|
||||
return response()->json(['message', 'Cannot detach owner.'],400);
|
||||
|
||||
/* If the user passes the company user we archive the company user */
|
||||
$user = $this->user_repo->delete($request->all(), $user);
|
||||
|
||||
@ -603,6 +606,9 @@ class UserController extends BaseController
|
||||
*/
|
||||
public function detach(DetachCompanyUserRequest $request, User $user)
|
||||
{
|
||||
if($user->isOwner())
|
||||
return response()->json(['message', 'Cannot detach owner.'],400);
|
||||
|
||||
$company_user = CompanyUser::whereUserId($user->id)
|
||||
->whereCompanyId(auth()->user()->companyId())->first();
|
||||
|
||||
|
@ -17,6 +17,7 @@ use App\Models\Client;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Utils\Traits\CleanLineItems;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
|
||||
class StoreRecurringInvoiceRequest extends Request
|
||||
{
|
||||
@ -43,6 +44,7 @@ class StoreRecurringInvoiceRequest extends Request
|
||||
foreach (range(0, $documents) as $index) {
|
||||
$rules['documents.'.$index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||
}
|
||||
|
||||
} elseif ($this->input('documents')) {
|
||||
$rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||
}
|
||||
@ -62,6 +64,16 @@ class StoreRecurringInvoiceRequest extends Request
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
// foreach($this->input('documents') as $document)
|
||||
// {
|
||||
// if($document instanceof UploadedFile){
|
||||
// nlog("i am an uploaded file");
|
||||
// nlog($document);
|
||||
// }
|
||||
// else
|
||||
// nlog($document);
|
||||
// }
|
||||
|
||||
if (array_key_exists('design_id', $input) && is_string($input['design_id'])) {
|
||||
$input['design_id'] = $this->decodePrimaryKey($input['design_id']);
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ use App\Http\Requests\Request;
|
||||
use App\Utils\Traits\ChecksEntityStatus;
|
||||
use App\Utils\Traits\CleanLineItems;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
|
||||
class UpdateRecurringInvoiceRequest extends Request
|
||||
{
|
||||
@ -57,6 +58,16 @@ class UpdateRecurringInvoiceRequest extends Request
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
// foreach($this->input('documents') as $document)
|
||||
// {
|
||||
// if($document instanceof UploadedFile){
|
||||
// nlog("i am an uploaded file");
|
||||
// nlog($document);
|
||||
// }
|
||||
// else
|
||||
// nlog($document);
|
||||
// }
|
||||
|
||||
if (array_key_exists('design_id', $input) && is_string($input['design_id'])) {
|
||||
$input['design_id'] = $this->decodePrimaryKey($input['design_id']);
|
||||
}
|
||||
|
@ -107,6 +107,9 @@ class UserRepository extends BaseRepository
|
||||
|
||||
public function destroy(array $data, User $user)
|
||||
{
|
||||
if($user->isOwner())
|
||||
return $user;
|
||||
|
||||
if (array_key_exists('company_user', $data)) {
|
||||
$this->forced_includes = 'company_users';
|
||||
|
||||
|
@ -91,6 +91,8 @@ class Phantom
|
||||
|
||||
$instance = Storage::disk(config('filesystems.default'))->put($file_path, $pdf);
|
||||
|
||||
nlog($instance);
|
||||
nlog($file_path);
|
||||
return $file_path;
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ return [
|
||||
'hash_salt' => env('HASH_SALT', ''),
|
||||
'currency_converter_api_key' => env('OPENEXCHANGE_APP_ID', ''),
|
||||
'enabled_modules' => 32767,
|
||||
'phantomjs_key' => env('PHANTOMJS_KEY', false),
|
||||
'phantomjs_key' => env('PHANTOMJS_KEY', 'a-demo-key-with-low-quota-per-ip-address'),
|
||||
'phantomjs_secret' => env('PHANTOMJS_SECRET', false),
|
||||
'phantomjs_pdf_generation' => env('PHANTOMJS_PDF_GENERATION', true),
|
||||
'trusted_proxies' => env('TRUSTED_PROXIES', false),
|
||||
|
119
resources/views/portal/ninja2020/layout/clean_setup.blade.php
Normal file
119
resources/views/portal/ninja2020/layout/clean_setup.blade.php
Normal file
@ -0,0 +1,119 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
|
||||
<head>
|
||||
<!-- Error: {{ session('error') }} -->
|
||||
|
||||
@if (config('services.analytics.tracking_id'))
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-122229484-1"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
|
||||
function gtag() {
|
||||
dataLayer.push(arguments);
|
||||
}
|
||||
|
||||
gtag('js', new Date());
|
||||
gtag('config', '{{ config('services.analytics.tracking_id') }}', {'anonymize_ip': true});
|
||||
|
||||
function trackEvent(category, action) {
|
||||
ga('send', 'event', category, action, this.src);
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
Vue.config.devtools = true;
|
||||
</script>
|
||||
@else
|
||||
<script>
|
||||
function gtag() {
|
||||
}
|
||||
</script>
|
||||
@endif
|
||||
|
||||
<!-- Title -->
|
||||
@auth()
|
||||
<title>@yield('meta_title', '') — {{ auth('contact')->user()->user->account->isPaid() ? auth('contact')->user()->company->present()->name() : 'Invoice Ninja' }}</title>
|
||||
@endauth
|
||||
|
||||
@guest
|
||||
<title>@yield('meta_title', '') — {{ config('app.name') }}</title>
|
||||
@endguest
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="@yield('meta_description')"/>
|
||||
|
||||
<!-- CSRF Token -->
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<!-- Scripts -->
|
||||
@if(strpos(Request::url(),'setup') === false)
|
||||
<script src="{{ mix('js/app.js') }}" defer></script>
|
||||
@else
|
||||
<script src="{{ str_replace("setup", "", Request::url())}}js/app.js" defer></script>
|
||||
@endif
|
||||
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.7.x/dist/alpine.min.js" defer></script>
|
||||
|
||||
<!-- Fonts -->
|
||||
<link rel="dns-prefetch" href="https://fonts.gstatic.com">
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans&display=swap" rel="stylesheet" type="text/css">
|
||||
|
||||
<!-- Styles -->
|
||||
@if(strpos(Request::url(),'setup') === false)
|
||||
<link href="{{ mix('css/app.css') }}" rel="stylesheet">
|
||||
@else
|
||||
<link href="{{ str_replace("setup", "", Request::url())}}css/app.css" rel="stylesheet">
|
||||
@endif
|
||||
{{-- <link href="{{ mix('favicon.png') }}" rel="shortcut icon" type="image/png"> --}}
|
||||
|
||||
<link rel="canonical" href="{{ config('ninja.app_url') }}/{{ request()->path() }}"/>
|
||||
|
||||
{{-- Feel free to push anything to header using @push('header') --}}
|
||||
@stack('head')
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.css" />
|
||||
</head>
|
||||
|
||||
@include('portal.ninja2020.components.primary-color')
|
||||
|
||||
<body class="antialiased {{ $custom_body_class ?? '' }}">
|
||||
@if(session()->has('message'))
|
||||
<div class="py-1 text-sm text-center text-white bg-primary disposable-alert">
|
||||
{{ session('message') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@yield('body')
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js" data-cfasync="false"></script>
|
||||
<script>
|
||||
window.addEventListener("load", function(){
|
||||
if (! window.cookieconsent) {
|
||||
return;
|
||||
}
|
||||
window.cookieconsent.initialise({
|
||||
"palette": {
|
||||
"popup": {
|
||||
"background": "#000"
|
||||
},
|
||||
"button": {
|
||||
"background": "#f1d600"
|
||||
},
|
||||
},
|
||||
"content": {
|
||||
"href": "https://www.invoiceninja.com/privacy-policy/",
|
||||
"message": "This website uses cookies to ensure you get the best experience on our website.",
|
||||
"dismiss": "Got it!",
|
||||
"link": "Learn more",
|
||||
}
|
||||
})}
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
|
||||
<footer>
|
||||
@yield('footer')
|
||||
@stack('footer')
|
||||
</footer>
|
||||
|
||||
</html>
|
@ -1,4 +1,4 @@
|
||||
@extends('portal.ninja2020.layout.clean')
|
||||
@extends('portal.ninja2020.layout.clean_setup')
|
||||
@section('meta_title', ctrans('texts.setup'))
|
||||
|
||||
@section('body')
|
||||
|
Loading…
x
Reference in New Issue
Block a user