Merge pull request #1015 from keriati/feat/testpwinject
feat: Inject password from db during testing when editing enhanced apps
This commit is contained in:
commit
44fb923b7f
6 changed files with 33 additions and 2824 deletions
|
@ -407,6 +407,15 @@ class ItemController extends Controller
|
|||
$single = Application::single($data['type']);
|
||||
$app = $single->class;
|
||||
|
||||
// If password is not resubmitted fill it from the database when in edit mode
|
||||
if ($data['password'] === null && array_key_exists('id', $data)) {
|
||||
$item = Item::find($data['id']);
|
||||
if ($item) {
|
||||
$itemConfig = $item->getConfig();
|
||||
$data['password'] = $itemConfig->password;
|
||||
}
|
||||
}
|
||||
|
||||
$app_details = new $app();
|
||||
$app_details->config = (object) $data;
|
||||
$app_details->test();
|
||||
|
|
2068
public/css/app.css
vendored
2068
public/css/app.css
vendored
File diff suppressed because one or more lines are too long
756
public/js/app.js
vendored
756
public/js/app.js
vendored
File diff suppressed because one or more lines are too long
4
public/mix-manifest.json
generated
4
public/mix-manifest.json
generated
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/css/app.css": "/css/app.css?id=ad45b1705b7f7906db0b",
|
||||
"/js/app.js": "/js/app.js?id=19a3a77634861ef418d7"
|
||||
"/css/app.css": "/css/app.css?id=fb9e13c65ffee8ba7340",
|
||||
"/js/app.js": "/js/app.js?id=7f1d4778de811d7fc901"
|
||||
}
|
||||
|
|
|
@ -2,6 +2,18 @@ $.when( $.ready ).then(function() {
|
|||
|
||||
var base = (document.querySelector('base') || {}).href;
|
||||
|
||||
var itemID = $('form[data-item-id]').data('item-id');
|
||||
var fakePassword = '*****';
|
||||
|
||||
// If in edit mode and password field is present, fill it with stars
|
||||
if (itemID) {
|
||||
var passwordField = $('input[name="config[password]"]').first();
|
||||
|
||||
if (passwordField.length > 0) {
|
||||
passwordField.attr('value', fakePassword);
|
||||
}
|
||||
}
|
||||
|
||||
if($('.message-container').length) {
|
||||
setTimeout(
|
||||
function()
|
||||
|
@ -224,6 +236,12 @@ $.when( $.ready ).then(function() {
|
|||
data[config] = $(this).val();
|
||||
});
|
||||
|
||||
data['id'] = $('form[data-item-id]').data('item-id');
|
||||
|
||||
if (data.password && data.password === fakePassword) {
|
||||
data.password = '';
|
||||
}
|
||||
|
||||
$.post(base+'test_config', { data: data }, function(data) {
|
||||
alert(data);
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
@section('content')
|
||||
|
||||
{!! Form::model($item, ['method' => 'PATCH', 'id' => 'itemform', 'files' => true, 'route' => ['items.update', $item->id]]) !!}
|
||||
{!! Form::model($item, ['data-item-id' =>$item->id, 'method' => 'PATCH', 'id' => 'itemform', 'files' => true, 'route' => ['items.update', $item->id]]) !!}
|
||||
@include('items.form')
|
||||
{!! Form::close() !!}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue