File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
app/Http/Requests/Api/Client/Account
resources/scripts/components/dashboard/forms Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -17,4 +17,14 @@ public function rules(): array
1717 'allowed_ips.* ' => 'ip ' ,
1818 ];
1919 }
20+
21+ /**
22+ * @return array|string[]
23+ */
24+ public function messages ()
25+ {
26+ return [
27+ 'allowed_ips.* ' => 'All of the IP addresses entered must be valid IPv4 addresses. ' ,
28+ ];
29+ }
2030}
Original file line number Diff line number Diff line change @@ -12,12 +12,15 @@ import { ApiKey } from '@/api/account/getApiKeys';
1212import tw from 'twin.macro' ;
1313import Button from '@/components/elements/Button' ;
1414import Input , { Textarea } from '@/components/elements/Input' ;
15+ import styled from 'styled-components/macro' ;
1516
1617interface Values {
1718 description : string ;
1819 allowedIps : string ;
1920}
2021
22+ const CustomTextarea = styled ( Textarea ) `${ tw `h-32` } ` ;
23+
2124export default ( { onKeyCreated } : { onKeyCreated : ( key : ApiKey ) => void } ) => {
2225 const [ apiKey , setApiKey ] = useState ( '' ) ;
2326 const { addError, clearFlashes } = useStoreActions ( ( actions : Actions < ApplicationStore > ) => actions . flashes ) ;
@@ -66,10 +69,7 @@ export default ({ onKeyCreated }: { onKeyCreated: (key: ApiKey) => void }) => {
6669 </ Modal >
6770 < Formik
6871 onSubmit = { submit }
69- initialValues = { {
70- description : '' ,
71- allowedIps : '' ,
72- } }
72+ initialValues = { { description : '' , allowedIps : '' } }
7373 validationSchema = { object ( ) . shape ( {
7474 allowedIps : string ( ) ,
7575 description : string ( ) . required ( ) . min ( 4 ) ,
@@ -91,7 +91,7 @@ export default ({ onKeyCreated }: { onKeyCreated: (key: ApiKey) => void }) => {
9191 name = { 'allowedIps' }
9292 description = { 'Leave blank to allow any IP address to use this API key, otherwise provide each IP address on a new line.' }
9393 >
94- < Field as = { Textarea } name = { 'allowedIps' } css = { tw `h-32` } />
94+ < Field name = { 'allowedIps' } as = { CustomTextarea } />
9595 </ FormikFieldWrapper >
9696 < div css = { tw `flex justify-end mt-6` } >
9797 < Button > Create</ Button >
You can’t perform that action at this time.
0 commit comments