fix: component behavior for obfuscated fields

This commit is contained in:
José Oliveira 2021-02-12 16:02:54 +00:00 committed by Josh Harvey
parent fcfe16d5eb
commit 54a19b25c1
13 changed files with 233 additions and 42 deletions

View file

@ -3,9 +3,12 @@ import * as Yup from 'yup'
import SecretInputFormik from 'src/components/inputs/formik/SecretInput'
import TextInputFormik from 'src/components/inputs/formik/TextInput'
import secretTest from './helper'
export default {
code: 'infura',
name: 'Infura',
hasSecret: true,
title: 'Infura (Wallet)',
elements: [
{
@ -37,5 +40,19 @@ export default {
endpoint: Yup.string()
.max(100, 'Too long')
.required()
})
}),
getValidationSchema: account => {
const schema = {
apiKey: Yup.string()
.max(100, 'Too long')
.required(),
apiSecret: Yup.string()
.max(100, 'Too long')
.test(secretTest(account?.apiSecret)),
endpoint: Yup.string()
.max(100, 'Too long')
.required()
}
return Yup.object().shape(schema)
}
}