Commit ad53b5a8 authored by tom's avatar tom

signature validation

parent cf97a102
export const SIGNATURE_REGEXP = /^0x[a-fA-F\d]{130}$/;
...@@ -41,6 +41,7 @@ const AddressVerificationModal = ({ isOpen, onClose }: Props) => { ...@@ -41,6 +41,7 @@ const AddressVerificationModal = ({ isOpen, onClose }: Props) => {
const handleClose = React.useCallback(() => { const handleClose = React.useCallback(() => {
onClose(); onClose();
setStepIndex(0); setStepIndex(0);
setError('');
formApi.reset(); formApi.reset();
}, [ formApi, onClose ]); }, [ formApi, onClose ]);
......
...@@ -5,6 +5,7 @@ import { Controller, useFormContext } from 'react-hook-form'; ...@@ -5,6 +5,7 @@ import { Controller, useFormContext } from 'react-hook-form';
import type { AddressVerificationFormFields } from '../types'; import type { AddressVerificationFormFields } from '../types';
import { SIGNATURE_REGEXP } from 'lib/validations/signature';
import InputPlaceholder from 'ui/shared/InputPlaceholder'; import InputPlaceholder from 'ui/shared/InputPlaceholder';
const AddressVerificationFieldSignature = () => { const AddressVerificationFieldSignature = () => {
...@@ -32,7 +33,7 @@ const AddressVerificationFieldSignature = () => { ...@@ -32,7 +33,7 @@ const AddressVerificationFieldSignature = () => {
name="signature" name="signature"
control={ control } control={ control }
render={ renderControl } render={ renderControl }
rules={{ required: true }} rules={{ required: true, pattern: SIGNATURE_REGEXP }}
/> />
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment