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

28
package-lock.json generated
View File

@ -7014,11 +7014,13 @@
}, },
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true "bundled": true,
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -7031,15 +7033,18 @@
}, },
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true "bundled": true,
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true "bundled": true,
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true "bundled": true,
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -7142,7 +7147,8 @@
}, },
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true "bundled": true,
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -7152,6 +7158,7 @@
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -7164,17 +7171,20 @@
"minimatch": { "minimatch": {
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
}, },
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true "bundled": true,
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.3.5", "version": "2.3.5",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -7191,6 +7201,7 @@
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -7263,7 +7274,8 @@
}, },
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true "bundled": true,
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -7273,6 +7285,7 @@
"once": { "once": {
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -7378,6 +7391,7 @@
"string-width": { "string-width": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",

View File

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

View File

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import withStyles from "@material-ui/core/styles/withStyles"; import withStyles from "@material-ui/core/styles/withStyles";
import {styles} from '../Register/registerStyle'; import {styles} from '../Register/registerStyle';
import {notification} from 'antd';
import Grid from '@material-ui/core/Grid'; import Grid from '@material-ui/core/Grid';
import Paper from '@material-ui/core/Paper'; import Paper from '@material-ui/core/Paper';
@ -43,7 +44,39 @@ class BTNLoginPage extends React.Component{
this.authStore = props.appstate.auth; 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({ this.setState({
[name]: event.target.value, [name]: event.target.value,
}); });
@ -138,7 +171,7 @@ class BTNLoginPage extends React.Component{
</Hidden> </Hidden>
<Grid item xs={12} sm={12} md={6} style={{paddingLeft : 50,paddingRight : 50}}> <Grid item xs={12} sm={12} md={6} style={{paddingLeft : 50,paddingRight : 50}}>
{ {
this.state.isNeedEmailVerification && this.state.isNeedEmailVerification &&
<Paper className={classes.formRegister}> <Paper className={classes.formRegister}>
<Typography variant="h6" gutterBottom> <Typography variant="h6" gutterBottom>
Your account still need email verification Your account still need email verification
@ -146,7 +179,7 @@ class BTNLoginPage extends React.Component{
<Typography variant="subtitle2" gutterBottom> <Typography variant="subtitle2" gutterBottom>
Still not received any email? <a onClick={()=>this.authStore.resendEmail(this.state.email)}>Resend email</a> Still not received any email? <a onClick={()=>this.authStore.resendEmail(this.state.email)}>Resend email</a>
</Typography> </Typography>
<div style={{padding : 5,marginTop : 20}}> <div style={{padding : 5,marginTop : 20}}>
<Button onClick={() => this.setState({isNeedEmailVerification : false})} fullWidth variant="contained" style={{background:'#ffeb3b'}}> <Button onClick={() => this.setState({isNeedEmailVerification : false})} fullWidth variant="contained" style={{background:'#ffeb3b'}}>
Back to Login Back to Login
@ -156,7 +189,7 @@ class BTNLoginPage extends React.Component{
} }
{ {
!this.state.isNeedEmailVerification && !this.state.isNeedEmailVerification &&
<Paper className={classes.formRegister}> <Paper className={classes.formRegister}>
<Typography variant="h6" gutterBottom> <Typography variant="h6" gutterBottom>
Login to BTN Point Login to BTN Point
@ -202,7 +235,7 @@ class BTNLoginPage extends React.Component{
</div> </div>
</Paper> </Paper>
} }
</Grid> </Grid>
</Grid> </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 @action
logout() { logout() {
this.context.setToken(""); this.context.setToken("");