Compare commits
2 Commits
make-error
...
password-v
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31036e7e5e | ||
|
|
cb7e2ad921 |
@@ -33,6 +33,8 @@ import Instance from '../../../../../../../components/Connection';
|
|||||||
import Checkbox from 'material-ui/Checkbox';
|
import Checkbox from 'material-ui/Checkbox';
|
||||||
import Popover from 'material-ui/Popover';
|
import Popover from 'material-ui/Popover';
|
||||||
|
|
||||||
|
const ADDRESS_TYPE_HOME = "home";
|
||||||
|
|
||||||
let DateTimeFormat;
|
let DateTimeFormat;
|
||||||
|
|
||||||
|
|
||||||
@@ -469,6 +471,16 @@ class VerticalNonLinear extends React.Component {
|
|||||||
if (user.useruuid !== loggedUser.useruuid) {
|
if (user.useruuid !== loggedUser.useruuid) {
|
||||||
Instance.getRawConn().get(`/v1/nemt/users/member/${user.useruuid}`)
|
Instance.getRawConn().get(`/v1/nemt/users/member/${user.useruuid}`)
|
||||||
.then(function (res) {
|
.then(function (res) {
|
||||||
|
let userHomeAddress = null;
|
||||||
|
res.data.addresses.forEach(address => {
|
||||||
|
if (address.address_type === ADDRESS_TYPE_HOME) {
|
||||||
|
userHomeAddress = address;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (userHomeAddress != null) {
|
||||||
|
userHomeAddress.name = "Home";
|
||||||
|
state.handlePickupChanged(userHomeAddress, state);
|
||||||
|
}
|
||||||
state.setState(Object.assign(state.state, { user: res.data, showUserSelection: true, userSelectionText: `${res.data.member} - ${res.data.name}` }));
|
state.setState(Object.assign(state.state, { user: res.data, showUserSelection: true, userSelectionText: `${res.data.member} - ${res.data.name}` }));
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
@@ -894,7 +906,17 @@ class VerticalNonLinear extends React.Component {
|
|||||||
|
|
||||||
if (this.state.showUserSelection && this.state.users.length > 0) {
|
if (this.state.showUserSelection && this.state.users.length > 0) {
|
||||||
const handleAutocomplete = (u) => {
|
const handleAutocomplete = (u) => {
|
||||||
state.setState(Object.assign(state.state, { user: u, userSelectionText: u.userdata }));
|
let userHomeAddress = null;
|
||||||
|
u.addresses.forEach(address => {
|
||||||
|
if (address.address_type === ADDRESS_TYPE_HOME) {
|
||||||
|
userHomeAddress = address;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (userHomeAddress != null) {
|
||||||
|
userHomeAddress.name = "Home";
|
||||||
|
state.handlePickupChanged(userHomeAddress,state);
|
||||||
|
}
|
||||||
|
state.setState(Object.assign(state.state, { user: u, userSelectionText: u.userdata }));
|
||||||
}
|
}
|
||||||
const datasourceConfig = { text: 'userdata', value: 'useruuid' }
|
const datasourceConfig = { text: 'userdata', value: 'useruuid' }
|
||||||
userSelection = (
|
userSelection = (
|
||||||
|
|||||||
@@ -47,7 +47,9 @@ class SignUp extends React.Component {
|
|||||||
"role": { name: "", key: "SP", desc: "" },
|
"role": { name: "", key: "SP", desc: "" },
|
||||||
"profiles": [],
|
"profiles": [],
|
||||||
"types": [],
|
"types": [],
|
||||||
"organizations": []
|
"organizations": [],
|
||||||
|
showValidationErrors : false,
|
||||||
|
validationErrors: []
|
||||||
}
|
}
|
||||||
|
|
||||||
this.buttonValidated = this.buttonValidated.bind(this);
|
this.buttonValidated = this.buttonValidated.bind(this);
|
||||||
@@ -226,12 +228,42 @@ class SignUp extends React.Component {
|
|||||||
localStorage.removeItem('loggedUser');
|
localStorage.removeItem('loggedUser');
|
||||||
location.href = '/#/login';
|
location.href = '/#/login';
|
||||||
}).catch(function (err) {
|
}).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);
|
console.error(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleDismiss(){
|
||||||
|
this.setState(Object.assign(this.state, { showErrorMessage: false }));
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
let validationErrors = null;
|
||||||
|
if (this.state.showValidationErrors){
|
||||||
|
validationErrors = (
|
||||||
|
<ul>
|
||||||
|
{this.state.validationErrors.map(errorMessage=>{
|
||||||
|
const oneValidationMessage = (<li>{errorMessage.message}</li>);
|
||||||
|
const oneValidationMessageWithTab = (<span><li style={{marginLeft:2 + "em"}}>{errorMessage.message}</li></span>);
|
||||||
|
|
||||||
|
if (errorMessage.field_name === "password-tab"){
|
||||||
|
return oneValidationMessageWithTab;
|
||||||
|
} else{
|
||||||
|
return oneValidationMessage;
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="body-inner">
|
<div className="body-inner">
|
||||||
|
|
||||||
@@ -334,6 +366,10 @@ class SignUp extends React.Component {
|
|||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<p className="text-small">By clicking on sign up, you agree to <a href="javascript:;"><i>terms</i></a> and <a href="javascript:;"><i>privacy policy</i></a></p>
|
<p className="text-small">By clicking on sign up, you agree to <a href="javascript:;"><i>terms</i></a> and <a href="javascript:;"><i>privacy policy</i></a></p>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="divider" />
|
||||||
|
<div className="form-group">
|
||||||
|
{validationErrors}
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user