Enforce Create form validation

This commit is contained in:
Bubka 2020-11-14 18:48:27 +01:00
parent 657b9288da
commit acd1b2deca
2 changed files with 6 additions and 2 deletions

View File

@ -37,10 +37,10 @@ public function store(Request $request)
$this->validate($request, [ $this->validate($request, [
'service' => 'required|string', 'service' => 'required|string',
'account' => 'nullable|string', 'account' => 'required_without:uri|nullable|string|regex:/^[^:]+$/i',
'icon' => 'nullable|string', 'icon' => 'nullable|string',
'uri' => 'nullable|string|regex:/^otpauth:\/\/[h,t]otp\//i', 'uri' => 'nullable|string|regex:/^otpauth:\/\/[h,t]otp\//i',
'otpType' => 'required_without:uri|in:TOTP,HOTP', 'otpType' => 'required_without:uri|in:totp,hotp,TOTP,HOTP',
'secret' => 'required_without:uri|string', 'secret' => 'required_without:uri|string',
'digits' => 'nullable|integer|between:6,10', 'digits' => 'nullable|integer|between:6,10',
'algorithm' => 'nullable|in:sha1,sha256,sha512,md5', 'algorithm' => 'nullable|in:sha1,sha256,sha512,md5',

View File

@ -148,6 +148,10 @@
'secret' => [ 'secret' => [
'required_without' => 'The :attribute field is required.', 'required_without' => 'The :attribute field is required.',
], ],
'account' => [
'required_without' => 'The :attribute field is required.',
'regex' => 'The :attribute field must not contain colon.',
],
], ],
/* /*