feat: email verification
This commit is contained in:
parent
327e01ef9e
commit
2f4c76d48a
|
@ -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,
|
||||
});
|
||||
|
|
|
@ -73,6 +73,13 @@ export class Authentication {
|
|||
})
|
||||
}
|
||||
|
||||
@action
|
||||
verifyEmail(key) {
|
||||
return this.http.post('authentication/email_verification', {
|
||||
key
|
||||
})
|
||||
}
|
||||
|
||||
@action
|
||||
logout() {
|
||||
this.context.setToken("");
|
||||
|
|
Loading…
Reference in New Issue
Block a user