File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
react-app/src/components/LemmaForm Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,12 @@ import {
14
14
} from 'reactstrap' ;
15
15
import { IoMdTrash } from 'react-icons/io' ;
16
16
import './LemmaForm.css' ;
17
- import { isNotRef , isNotOwner , isUrl } from '../../helpers/input-validation' ;
17
+ import {
18
+ isNotRef ,
19
+ isNotOwner ,
20
+ isUrl ,
21
+ isEmail
22
+ } from '../../helpers/input-validation' ;
18
23
import {
19
24
RECAPTCHA_CLIENT_KEY ,
20
25
BASE_URL ,
@@ -158,7 +163,11 @@ const LemmaForm = (props: any) => {
158
163
: setUrl ( { link : val , invalid : true } ) ;
159
164
} ;
160
165
const handleOwner = ( input : EventTarget & HTMLInputElement ) => {
161
- if ( isNotOwner . test ( input . value ) && input . id === 'name' ) {
166
+ if (
167
+ ( ( isNotOwner . test ( input . value ) && ! isEmail . test ( input . value ) ) ||
168
+ ( ! isNotOwner . test ( input . value ) && isEmail . test ( input . value ) ) ) &&
169
+ input . id === 'name'
170
+ ) {
162
171
setOwner ( { ...owner , [ input . id ] : input . value , invalid : true } ) ;
163
172
} else {
164
173
setOwner ( { ...owner , [ input . id ] : input . value , invalid : false } ) ;
@@ -260,7 +269,7 @@ const LemmaForm = (props: any) => {
260
269
onChange = { e => handleOwner ( e . target ) }
261
270
/>
262
271
< FormFeedback invalid = "" >
263
- Username must not contain (@, /, or whitespace)
272
+ Username must be an valid email or username
264
273
</ FormFeedback >
265
274
</ FormGroup >
266
275
</ Col >
You can’t perform that action at this time.
0 commit comments