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