diff --git a/src/routes/signUp/components/SignUp.js b/src/routes/signUp/components/SignUp.js index a8b0a0c..e9f15e5 100644 --- a/src/routes/signUp/components/SignUp.js +++ b/src/routes/signUp/components/SignUp.js @@ -47,7 +47,9 @@ class SignUp extends React.Component { "role": { name: "", key: "SP", desc: "" }, "profiles": [], "types": [], - "organizations": [] + "organizations": [], + showValidationErrors : false, + validationErrors: [] } this.buttonValidated = this.buttonValidated.bind(this); @@ -226,12 +228,42 @@ class SignUp extends React.Component { localStorage.removeItem('loggedUser'); location.href = '/#/login'; }).catch(function (err) { - alert('Error to log in: ' + err.message); + if (err.response.status === 422){ + //Unprocessable Entity (validation failed) + state.setState(Object.assign(state.state, { + showValidationErrors:true, + validationErrors:err.response.data.data + })); + }else{ + alert('Error to log in: ' + err.message); + } console.error(err); }); } + handleDismiss(){ + this.setState(Object.assign(this.state, { showErrorMessage: false })); + } + render() { + let validationErrors = null; + if (this.state.showValidationErrors){ + validationErrors = ( + + ); + } + return (
@@ -334,6 +366,10 @@ class SignUp extends React.Component {

By clicking on sign up, you agree to terms and privacy policy

+
+
+ {validationErrors} +