diff --git a/jsx/Form.js b/jsx/Form.js index 38ad773ef54..ca0902630f8 100644 --- a/jsx/Form.js +++ b/jsx/Form.js @@ -1614,6 +1614,7 @@ class ButtonElement extends Component { type={this.props.type} className={this.props.buttonClass} onClick={this.handleClick} + disabled={this.props.disabled} > {this.props.label} @@ -1627,12 +1628,14 @@ ButtonElement.propTypes = { name: PropTypes.string, label: PropTypes.string, type: PropTypes.string, + disabled: PropTypes.bool, onUserInput: PropTypes.func, }; ButtonElement.defaultProps = { label: 'Submit', type: 'submit', + disabled: null, buttonClass: 'btn btn-primary', columnSize: 'col-sm-9 col-sm-offset-3', onUserInput: function() { diff --git a/modules/candidate_list/jsx/candidateListIndex.js b/modules/candidate_list/jsx/candidateListIndex.js index 1bfbade86d6..e201bda0c25 100644 --- a/modules/candidate_list/jsx/candidateListIndex.js +++ b/modules/candidate_list/jsx/candidateListIndex.js @@ -125,7 +125,7 @@ class CandidateListIndex extends Component { if (column === 'Subproject') { // If user has multiple subprojects, join array into string - let result = (cell) ? {cell.join(', ')} : null; + let result = (cell) ? {cell.join(', ')} : ; return result; } diff --git a/modules/login/php/requestaccount.class.inc b/modules/login/php/requestaccount.class.inc index d3080a39602..d0c9492764c 100644 --- a/modules/login/php/requestaccount.class.inc +++ b/modules/login/php/requestaccount.class.inc @@ -144,9 +144,9 @@ class RequestAccount extends \NDB_Form function _process($values) { $DB = \Database::singleton(); - $name = htmlspecialchars($_REQUEST["firstname"], ENT_QUOTES); - $lastname = htmlspecialchars($_REQUEST["lastname"], ENT_QUOTES); - $from = htmlspecialchars($_REQUEST["from"], ENT_QUOTES); + $name = trim(htmlspecialchars($_REQUEST["firstname"], ENT_QUOTES)); + $lastname = trim(htmlspecialchars($_REQUEST["lastname"], ENT_QUOTES)); + $from = trim(htmlspecialchars($_REQUEST["from"], ENT_QUOTES)); $site = $_REQUEST["site"]; $fullname = $name." ".$lastname; diff --git a/modules/new_profile/jsx/NewProfileIndex.js b/modules/new_profile/jsx/NewProfileIndex.js index ef2fab42d14..d18223aa43e 100644 --- a/modules/new_profile/jsx/NewProfileIndex.js +++ b/modules/new_profile/jsx/NewProfileIndex.js @@ -19,6 +19,7 @@ class NewProfileIndex extends React.Component { isLoaded: false, isCreated: false, error: false, + submitDisabled: false, }; this.handleSubmit = this.handleSubmit.bind(this); this.setFormData = this.setFormData.bind(this); @@ -88,6 +89,9 @@ class NewProfileIndex extends React.Component { } formObject.append('fire_away', 'New Candidate'); + // disable button to prevent form resubmission. + this.setState({submitDisabled: true}); + fetch(this.props.submitURL, { method: 'POST', cache: 'no-cache', @@ -102,6 +106,8 @@ class NewProfileIndex extends React.Component { }); } else { resp.json().then((message) => { + // enable button for form resubmission. + this.setState({submitDisabled: false}); swal.fire('Error!', message, 'error'); }); } @@ -239,6 +245,7 @@ class NewProfileIndex extends React.Component { label = "Create" id = "button" type = "submit" + disabled={this.state.submitDisabled} /> );