An easy-to-use platform for EEG experimentation in the classroom
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Added sanitization of inputs to avoid bad workspaces

jdpigeon 1899dd46 ffd78b1f

+10 -7
+10 -7
app/components/InputModal.js
··· 1 1 // @flow 2 - import React, { Component } from 'react'; 3 - import { Input, Modal, Button } from 'semantic-ui-react'; 4 - import { debounce } from 'lodash'; 5 - import styles from './styles/common.css'; 2 + import React, { Component } from "react"; 3 + import { Input, Modal, Button } from "semantic-ui-react"; 4 + import { debounce } from "lodash"; 5 + import styles from "./styles/common.css"; 6 6 7 7 interface Props { 8 8 open: boolean; ··· 27 27 constructor(props: Props) { 28 28 super(props); 29 29 this.state = { 30 - enteredText: '', 30 + enteredText: "", 31 31 isError: false 32 32 }; 33 33 this.handleTextEntry = debounce(this.handleTextEntry, 100).bind(this); 34 34 this.handleClose = this.handleClose.bind(this); 35 35 this.handleEnterSubmit = this.handleEnterSubmit.bind(this); 36 36 this.handleExit = this.handleExit.bind(this); 37 + } 38 + sanitizeTextInput(text: string) { 39 + return text.replace(/[|&;$%@"<>()+,./]/g, ""); 37 40 } 38 41 39 42 handleTextEntry(event, data) { ··· 42 45 43 46 handleClose() { 44 47 if (this.state.enteredText.length > 1) { 45 - this.props.onClose(this.state.enteredText); 48 + this.props.onClose(this.sanitizeTextInput(this.state.enteredText)); 46 49 } else { 47 50 this.setState({ isError: true }); 48 51 } ··· 53 56 } 54 57 55 58 handleEnterSubmit(event: Object) { 56 - if (event.key === 'Enter') { 59 + if (event.key === "Enter") { 57 60 this.handleClose(); 58 61 } 59 62 }