From 327e01ef9eddeb4a2c3c15c3120d77dccdf3bd71 Mon Sep 17 00:00:00 2001 From: enggar_ganteng Date: Tue, 29 Jan 2019 14:50:25 +0700 Subject: [PATCH 1/2] fix auto complete --- package-lock.json | 28 +++++++++++++++------ src/common/components/AutoComplete/index.js | 8 +++--- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index ebe8abb..2557cee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7014,11 +7014,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -7031,15 +7033,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -7142,7 +7147,8 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -7152,6 +7158,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -7164,17 +7171,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -7191,6 +7201,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -7263,7 +7274,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -7273,6 +7285,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -7378,6 +7391,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/src/common/components/AutoComplete/index.js b/src/common/components/AutoComplete/index.js index 6356ae3..dbdece2 100644 --- a/src/common/components/AutoComplete/index.js +++ b/src/common/components/AutoComplete/index.js @@ -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: { From 2f4c76d48adcb421d7b7ea0c83df0d0064a433b7 Mon Sep 17 00:00:00 2001 From: Hasta Ragil Saputra Date: Tue, 29 Jan 2019 15:12:06 +0700 Subject: [PATCH 2/2] feat: email verification --- src/common/pages/Login/LoginBtn.js | 45 ++++++++++++++++++++++++++---- src/common/stores/authenticaton.js | 7 +++++ 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/src/common/pages/Login/LoginBtn.js b/src/common/pages/Login/LoginBtn.js index 99a09eb..7e390fd 100644 --- a/src/common/pages/Login/LoginBtn.js +++ b/src/common/pages/Login/LoginBtn.js @@ -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, }); @@ -131,7 +164,7 @@ class BTNLoginPage extends React.Component{ { - this.state.isNeedEmailVerification && + this.state.isNeedEmailVerification && Your account still need email verification @@ -139,7 +172,7 @@ class BTNLoginPage extends React.Component{ Still not received any email? Resend email - +
} - +
@@ -205,4 +238,4 @@ class BTNLoginPage extends React.Component{ } } -export default withStyles(styles)(BTNLoginPage); \ No newline at end of file +export default withStyles(styles)(BTNLoginPage); diff --git a/src/common/stores/authenticaton.js b/src/common/stores/authenticaton.js index d4ba8d7..9b4f500 100644 --- a/src/common/stores/authenticaton.js +++ b/src/common/stores/authenticaton.js @@ -73,6 +73,13 @@ export class Authentication { }) } + @action + verifyEmail(key) { + return this.http.post('authentication/email_verification', { + key + }) + } + @action logout() { this.context.setToken("");