Skip to content

Commit

Permalink
Fixes #2415 - only allow gif, png jpg, svg image uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Dec 6, 2017
1 parent dfb0c09 commit 0239104
Show file tree
Hide file tree
Showing 19 changed files with 67 additions and 83 deletions.
2 changes: 1 addition & 1 deletion public/css/build/all.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/dist/all.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/overrides.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions public/mix-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
4 changes: 4 additions & 0 deletions resources/assets/less/overrides.less
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,7 @@ img.navbar-brand-img, .navbar-brand>img {
.btn.bg-maroon, .btn.bg-purple{
min-width:90px;
}

[hidden] {
display: none !important;
}
1 change: 1 addition & 0 deletions resources/lang/en/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
18 changes: 9 additions & 9 deletions resources/views/accessories/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
11 changes: 8 additions & 3 deletions resources/views/account/profile.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' : '' }}">
Expand Down
8 changes: 1 addition & 7 deletions resources/views/categories/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 1 addition & 8 deletions resources/views/companies/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 1 addition & 7 deletions resources/views/components/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 1 addition & 7 deletions resources/views/consumables/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 1 addition & 7 deletions resources/views/departments/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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

8 changes: 1 addition & 7 deletions resources/views/locations/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 1 addition & 7 deletions resources/views/manufacturers/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 1 addition & 7 deletions resources/views/models/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 11 additions & 0 deletions resources/views/partials/forms/edit/image-upload.blade.php
Original file line number Diff line number Diff line change
@@ -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>
Loading

0 comments on commit 0239104

Please sign in to comment.