Compare commits
3 Commits
master
...
phone-mask
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b4e6cfce2 | ||
|
|
1817ec7ee3 | ||
|
|
942e339f39 |
@@ -19,6 +19,7 @@ import Instance from '../../../components/Connection';
|
|||||||
|
|
||||||
import Checkbox from 'material-ui/Checkbox';
|
import Checkbox from 'material-ui/Checkbox';
|
||||||
|
|
||||||
|
import InputMask from 'react-input-mask';
|
||||||
import ValidationErrorsInfoDialog from '../../../components/Shared/ValidationErrorsInfoDialog';
|
import ValidationErrorsInfoDialog from '../../../components/Shared/ValidationErrorsInfoDialog';
|
||||||
|
|
||||||
class SignUp extends React.Component {
|
class SignUp extends React.Component {
|
||||||
@@ -61,15 +62,15 @@ class SignUp extends React.Component {
|
|||||||
|
|
||||||
componentDidMount = () => { }
|
componentDidMount = () => { }
|
||||||
|
|
||||||
getFormattedPhoneNumber(){
|
getFormattedPhoneNumber(phone){
|
||||||
if(this.state.phone_number && this.state.phone_number.length > 0) {
|
if(phone && phone.length > 0) {
|
||||||
return this.state.phone_number.replace('+1','').replace('(','').replace(')','').replace('-','').replace(' ','').trim()
|
return phone.replace('+1','').replace('(','').replace(')','').replace('-','').replace(' ','').trim()
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
isPhoneNumberFormatValid() {
|
isPhoneNumberFormatValid() {
|
||||||
let formattedNumber = this.getFormattedPhoneNumber();
|
let formattedNumber = this.getFormattedPhoneNumber(this.state.phone_number);
|
||||||
return !isNaN(formattedNumber) && (formattedNumber.toString().length === 10);
|
return !isNaN(formattedNumber) && (formattedNumber.toString().length === 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +109,7 @@ class SignUp extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
handlePhone = (event) => {
|
handlePhone = (event) => {
|
||||||
let phone = event.target.value;
|
let phone = this.getFormattedPhoneNumber(event.target.value);
|
||||||
if (phone.indexOf("+1") < 0 && phone.length == 10) {
|
if (phone.indexOf("+1") < 0 && phone.length == 10) {
|
||||||
phone = "+1" + phone;
|
phone = "+1" + phone;
|
||||||
phone = phone.substring(0, 12);
|
phone = phone.substring(0, 12);
|
||||||
@@ -159,6 +160,9 @@ class SignUp extends React.Component {
|
|||||||
"pass": this.state.pass,
|
"pass": this.state.pass,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log(user);
|
||||||
|
return;
|
||||||
|
|
||||||
Instance.setToken(null).post('/v1/selfregister/', user).then(function (res) {
|
Instance.setToken(null).post('/v1/selfregister/', user).then(function (res) {
|
||||||
localStorage.removeItem('loggedUser');
|
localStorage.removeItem('loggedUser');
|
||||||
location.href = '/#/login';
|
location.href = '/#/login';
|
||||||
@@ -245,7 +249,9 @@ class SignUp extends React.Component {
|
|||||||
type="telephone"
|
type="telephone"
|
||||||
onChange={this.handlePhone}
|
onChange={this.handlePhone}
|
||||||
onBlur={this.buttonValidated}
|
onBlur={this.buttonValidated}
|
||||||
/>
|
>
|
||||||
|
<InputMask mask="(999) 999-9999" maskChar={null} value={this.state.phone_number} />
|
||||||
|
</TextField>
|
||||||
</div>
|
</div>
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<TextField
|
<TextField
|
||||||
|
|||||||
Reference in New Issue
Block a user