Enabled form validation

This commit is contained in:
2023-04-12 23:18:26 +10:00
parent f01f88b3bd
commit eafae02c7b
10 changed files with 87 additions and 28 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Classes\LDAP\Schema;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
@@ -271,6 +272,7 @@ final class AttributeType extends Base {
case 'type': return $this->type;
case 'usage': return $this->usage;
case 'used_in_object_classes': return $this->used_in_object_classes;
case 'validation': return Arr::get(config('ldap.validation'),$this->name_lc);
default: return parent::__get($key);
}

View File

@@ -112,10 +112,10 @@ class HomeController extends Controller
];
});
if (Session::has('dn'))
if (old('dn'))
return view('dn')
->with('bases',$bases)
->with('o',config('server')->fetch($dn=Crypt::decryptString(Session::pull('dn'))))
->with('o',config('server')->fetch($dn=Crypt::decryptString(old('dn'))))
->with('dn',$dn);
else
return view('home')

View File

@@ -23,9 +23,12 @@ class EntryRequest extends FormRequest
*/
public function rules()
{
return [
'dn'=>'string|min:3',
'objectclass'=>'array|min:1',
];
return config('server')
->schema('attributetypes')
->intersectByKeys($this->request)
->transform(function($item) { return $item->validation; })
->filter()
->flatMap(function($item) { return $item; })
->toArray();
}
}