update : loginPage
This commit is contained in:
		| @@ -36,7 +36,8 @@ class BTNLoginPage extends React.Component{ | ||||
|           password: "", | ||||
|           showPassword : false, | ||||
|           isLoading: false, | ||||
|           loginFailed: false | ||||
|           loginFailed: false, | ||||
|           isNeedEmailVerification: false, | ||||
|         }; | ||||
|         this.defaultState = Object.assign({}, this.state); | ||||
|         this.authStore = props.appstate.auth; | ||||
| @@ -63,10 +64,15 @@ class BTNLoginPage extends React.Component{ | ||||
|             password: password, | ||||
|         } | ||||
|         this.authStore.login(data).then(res => { | ||||
|             if(!res.need_email_verification){ | ||||
|                 setTimeout(()=>{ | ||||
|                     this.props.history.push(LINKS.DASHBOARD); | ||||
|                     this.setState({isLoading:false}); | ||||
|                 },1000); | ||||
|             } | ||||
|             else{ | ||||
|                 this.setState({isNeedEmailVerification:true}); | ||||
|             } | ||||
|         }).catch(err => { | ||||
|             this.setState({loginFailed:true,isLoading:false}); | ||||
|             setTimeout(()=>this.setState({loginFailed:false}),3000); | ||||
| @@ -122,6 +128,26 @@ class BTNLoginPage extends React.Component{ | ||||
|                                 </Grid> | ||||
|                             </Hidden> | ||||
|                             <Grid item xs={12} sm={12} md={6} style={{paddingLeft : 50,paddingRight : 50}}> | ||||
|                                 { | ||||
|                                     this.state.isNeedEmailVerification &&  | ||||
|                                         <Paper className={classes.formRegister}> | ||||
|                                             <Typography variant="h6" gutterBottom> | ||||
|                                                 Your account still need email verification | ||||
|                                             </Typography> | ||||
|                                             <Typography variant="subtitle2" gutterBottom> | ||||
|                                                 Still not received any email? <Link to={"/register"}>Resend email</Link> | ||||
|                                             </Typography> | ||||
|                                              | ||||
|                                             <div style={{padding : 5,marginTop : 20}}> | ||||
|                                                 <Button onClick={() => this.setState({isNeedEmailVerification : false})} fullWidth variant="contained" style={{background:'#ffeb3b'}}> | ||||
|                                                     Back to Login | ||||
|                                                 </Button> | ||||
|                                             </div> | ||||
|                                         </Paper> | ||||
|                                 } | ||||
|  | ||||
|                                 { | ||||
|                                     !this.state.isNeedEmailVerification &&  | ||||
|                                         <Paper className={classes.formRegister}> | ||||
|                                             <Typography variant="h6" gutterBottom> | ||||
|                                                 Login to BTN Point | ||||
| @@ -166,6 +192,8 @@ class BTNLoginPage extends React.Component{ | ||||
|                                                 </Button> | ||||
|                                             </div> | ||||
|                                         </Paper> | ||||
|                                 } | ||||
|                                  | ||||
|                             </Grid> | ||||
|                         </Grid> | ||||
|                     </Grid> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user