enggar_ganteng
2019-01-29 15:17:59 +07:00
4 changed files with 72 additions and 16 deletions

View File

@@ -43,16 +43,18 @@ const styles = theme => ({
padding: `${theme.spacing.unit}px ${theme.spacing.unit * 2}px`,
},
singleValue: {
position: 'absolute',
left: 12,
fontSize: 16,
},
placeholder: {
position: 'absolute',
left: 2,
left: 12,
fontSize: 16,
},
paper: {
position: 'absolute',
zIndex: 1,
zIndex: 999,
marginTop: theme.spacing.unit,
left: 0,
right: 0,
@@ -84,7 +86,7 @@ function Control(props) {
margin="normal"
variant="outlined"
fullWidth
style={{padding: 5}}
// style={{padding: 5}}
InputProps={{
inputComponent,
inputProps: {

View File

@@ -1,6 +1,7 @@
import React from 'react';
import withStyles from "@material-ui/core/styles/withStyles";
import {styles} from '../Register/registerStyle';
import {notification} from 'antd';
import Grid from '@material-ui/core/Grid';
import Paper from '@material-ui/core/Paper';
@@ -43,7 +44,39 @@ class BTNLoginPage extends React.Component{
this.authStore = props.appstate.auth;
}
handleChange = name => event => {
componentDidMount() {
const urlParams = new URLSearchParams(window.location.search);
if(urlParams.has('key')) {
this.setState({
isLoading: true
});
this.authStore.verifyEmail(urlParams.get('key')).then((res) => {
if(res.login_request_id) {
notification.open({
message: 'Email Verification',
description: 'Email verification success'
});
this.setState({
isLoading: false
});
//redirect to otp page
} else {
notification.open({
message: 'Email Verification',
description: res.message
});
this.setState({
isLoading: false
});
// res.message
}
})
}
}
handleChange = name => event => {
this.setState({
[name]: event.target.value,
});
@@ -138,7 +171,7 @@ class BTNLoginPage extends React.Component{
</Hidden>
<Grid item xs={12} sm={12} md={6} style={{paddingLeft : 50,paddingRight : 50}}>
{
this.state.isNeedEmailVerification &&
this.state.isNeedEmailVerification &&
<Paper className={classes.formRegister}>
<Typography variant="h6" gutterBottom>
Your account still need email verification
@@ -146,7 +179,7 @@ class BTNLoginPage extends React.Component{
<Typography variant="subtitle2" gutterBottom>
Still not received any email? <a onClick={()=>this.authStore.resendEmail(this.state.email)}>Resend email</a>
</Typography>
<div style={{padding : 5,marginTop : 20}}>
<Button onClick={() => this.setState({isNeedEmailVerification : false})} fullWidth variant="contained" style={{background:'#ffeb3b'}}>
Back to Login
@@ -156,7 +189,7 @@ class BTNLoginPage extends React.Component{
}
{
!this.state.isNeedEmailVerification &&
!this.state.isNeedEmailVerification &&
<Paper className={classes.formRegister}>
<Typography variant="h6" gutterBottom>
Login to BTN Point
@@ -202,7 +235,7 @@ class BTNLoginPage extends React.Component{
</div>
</Paper>
}
</Grid>
</Grid>
</Grid>
@@ -212,4 +245,4 @@ class BTNLoginPage extends React.Component{
}
}
export default withStyles(styles)(BTNLoginPage);
export default withStyles(styles)(BTNLoginPage);

View File

@@ -74,6 +74,13 @@ export class Authentication {
})
}
@action
verifyEmail(key) {
return this.http.post('authentication/email_verification', {
key
})
}
@action
logout() {
this.context.setToken("");