feat: email verification
This commit is contained in:
		| @@ -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,6 +44,38 @@ class BTNLoginPage extends React.Component{ | ||||
|         this.authStore = props.appstate.auth; | ||||
|       } | ||||
|  | ||||
|   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, | ||||
|   | ||||
| @@ -73,6 +73,13 @@ export class Authentication { | ||||
|       }) | ||||
|   } | ||||
|  | ||||
|   @action | ||||
|   verifyEmail(key) { | ||||
|     return this.http.post('authentication/email_verification', { | ||||
|       key | ||||
|     }) | ||||
|   } | ||||
|  | ||||
|   @action | ||||
|   logout() { | ||||
|     this.context.setToken(""); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user