Fixes #2415 - only allow gif, png jpg, svg image uploads

This commit is contained in:
snipe 2017-12-06 14:33:52 -08:00
parent dfb0c09c51
commit 023910472c
19 changed files with 64 additions and 80 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -2,13 +2,13 @@
"/js/build/vue.js": "/js/build/vue.js?id=e6804371942215bd1d7d",
"/css/AdminLTE.css": "/css/AdminLTE.css?id=b8be19a285eaf44eec37",
"/css/app.css": "/css/app.css?id=407edb63cc6b6dc62405",
"/css/overrides.css": "/css/overrides.css?id=ca0621c2a909d165534d",
"/css/overrides.css": "/css/overrides.css?id=1bdafb06a8609780f546",
"/js/build/vue.js.map": "/js/build/vue.js.map?id=3b3d417664a61dcce3e9",
"/css/AdminLTE.css.map": "/css/AdminLTE.css.map?id=99f5a5a03c4155cf69f6",
"/css/app.css.map": "/css/app.css.map?id=bdbe05e6ecd70ccfac72",
"/css/overrides.css.map": "/css/overrides.css.map?id=898c91d4a425b01b589b",
"/css/dist/all.css": "/css/dist/all.css?id=51e5995cec7ce583f5dd",
"/css/dist/all.css": "/css/dist/all.css?id=3a8aa974e7b09b52b18c",
"/js/dist/all.js": "/js/dist/all.js?id=88f08e0103b14f7949b3",
"/css/build/all.css": "/css/build/all.css?id=51e5995cec7ce583f5dd",
"/css/build/all.css": "/css/build/all.css?id=3a8aa974e7b09b52b18c",
"/js/build/all.js": "/js/build/all.js?id=88f08e0103b14f7949b3"
}

View file

@ -322,3 +322,7 @@ img.navbar-brand-img, .navbar-brand>img {
.btn.bg-maroon, .btn.bg-purple{
min-width:90px;
}
[hidden] {
display: none !important;
}

View file

@ -93,6 +93,7 @@
'image' => 'Image',
'image_delete' => 'Delete Image',
'image_upload' => 'Upload Image',
'image_filetypes_help' => 'Accepted filetypes are jpg, png, gif, and svg.',
'import' => 'Import',
'import-history' => 'Import History',
'asset_maintenance' => 'Asset Maintenance',

View file

@ -24,15 +24,15 @@
<!-- Image -->
<div class="form-group {{ $errors->has('image') ? ' has-error' : '' }}">
{{ Form::label('image', trans('general.image_upload'), array('class' => 'col-md-3 control-label')) }}
<div class="col-md-7">
@if (config('app.lock_passwords'))
<p class="help-block">{{ trans('general.lock_passwords') }}</p>
@else
{{ Form::file('image') }}
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
@endif
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
<label class="btn btn-default">
{{ trans('button.select_file') }}
<input type="file" name="image" accept="image/gif,image/jpeg,image/png,image/svg" hidden>
</label>
<p class="help-block">Accepted filetypes are jpg, png, gif and svg</p>
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
</div>
</div>

View file

@ -87,14 +87,19 @@
@endif
<div class="form-group {{ $errors->has('avatar') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="avatar">{{ trans('general.avatar_upload') }}</label>
<div class="col-md-8">
{{ Form::file('avatar') }}
<label class="col-md-3 control-label" for="avatar">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
<label class="btn btn-default">
{{ trans('button.select_file') }}
<input type="file" name="avatar" accept="image/gif,image/jpeg,image/png,image/svg" hidden>
</label>
<p class="help-block">{{ trans('general.image_filetypes_help') }}</p>
{!! $errors->first('avatar', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
<!-- Two factor opt in -->
@if ($snipeSettings->two_factor_enabled=='1')
<div class="form-group {{ $errors->has('avatar') ? 'has-error' : '' }}">

View file

@ -74,13 +74,7 @@
</div>
@endif
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
{{ Form::file('image') }}
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@include ('partials.forms.edit.image-upload')
@stop

View file

@ -22,12 +22,5 @@
</div>
@endif
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
{{ Form::file('image') }}
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@include ('partials.forms.edit.image-upload')
@stop

View file

@ -33,12 +33,6 @@
</div>
@endif
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
{{ Form::file('image') }}
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@include ('partials.forms.edit.image-upload')
@stop

View file

@ -33,11 +33,5 @@
</div>
@endif
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
{{ Form::file('image') }}
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@include ('partials.forms.edit.image-upload')
@stop

View file

@ -35,13 +35,7 @@
</div>
@endif
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
{{ Form::file('image') }}
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@include ('partials.forms.edit.image-upload')
@stop

View file

@ -62,13 +62,7 @@
</div>
@endif
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
{{ Form::file('image') }}
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@include ('partials.forms.edit.image-upload')
@stop
@if (!$item->id)

View file

@ -62,13 +62,7 @@
</div>
@endif
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
{{ Form::file('image') }}
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@include ('partials.forms.edit.image-upload')
@stop

View file

@ -56,12 +56,6 @@
</div>
@endif
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
{{ Form::file('image') }}
{!! $errors->first('image', '<span class="alert-msg"><br>:message</span>') !!}
</div>
</div>
@include ('partials.forms.edit.image-upload')
@stop

View file

@ -0,0 +1,11 @@
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
<label class="btn btn-default">
{{ trans('button.select_file') }}
<input type="file" name="image" accept="image/gif,image/jpeg,image/png,image/svg" hidden>
</label>
<p class="help-block">{{ trans('general.image_filetypes_help') }}</p>
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
</div>
</div>

View file

@ -61,21 +61,27 @@
<!-- Logo -->
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<div class="col-md-3">
{{ Form::label('logo', trans('admin/settings/general.logo')) }}
</div>
<label class="col-md-3 control-label" for="image">
{{ Form::label('logo', trans('admin/settings/general.logo')) }}</label>
<div class="col-md-9">
@if (config('app.lock_passwords'))
<p class="help-block">{{ trans('general.lock_passwords') }}</p>
@else
{{ Form::file('image') }}
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
{{ Form::checkbox('clear_logo', '1', Input::old('clear_logo'),array('class' => 'minimal')) }} Remove
@endif
<label class="btn btn-default">
{{ trans('button.select_file') }}
<input type="file" name="image" accept="image/gif,image/jpeg,image/png,image/svg" hidden>
</label>
<p class="help-block">{{ trans('general.image_filetypes_help') }}</p>
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
{{ Form::checkbox('clear_logo', '1', Input::old('clear_logo'),array('class' => 'minimal')) }} Remove
@endif
</div>
</div>
<!-- Branding -->
<div class="form-group {{ $errors->has('brand') ? 'error' : '' }}">
<div class="col-md-3">

View file

@ -6,6 +6,7 @@
'formAction' => ($item) ? route('suppliers.update', ['supplier' => $item->id]) : route('suppliers.store'),
])
{{-- Page content --}}
@section('inputFields')
@ -44,6 +45,7 @@
<!-- Image -->
@if ($item->image)
<div class="form-group {{ $errors->has('image_delete') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image_delete">{{ trans('general.image_delete') }}</label>
<div class="col-md-5">
@ -57,7 +59,11 @@
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
{{ Form::file('image') }}
<label class="btn btn-default">
{{ trans('button.select_file') }}
<input type="file" name="image" accept="image/gif,image/jpeg,image/png,image/svg" hidden>
</label>
<p class="help-block">Accepted filetypes are jpg, png, gif and svg</p>
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
</div>
</div>