File tree 3 files changed +24
-0
lines changed
3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ export default (apiEngine) => ({
4
4
verifyEmail : ( { token } ) => apiEngine . post ( '/api/users/email/verify' , {
5
5
data : { verifyEmailToken : token } ,
6
6
} ) ,
7
+ requestVerifyEmail : ( form ) => (
8
+ apiEngine . post ( '/api/users/email/request-verify' , { data : form } )
9
+ ) ,
7
10
login : ( user ) => apiEngine . post ( '/api/users/login' , { data : user } ) ,
8
11
requestResetPassword : ( form ) => (
9
12
apiEngine . post ( '/api/users/password/request-reset' , { data : form } )
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import Alert from 'react-bootstrap/lib/Alert';
6
6
import Button from 'react-bootstrap/lib/Button' ;
7
7
// import validator from 'validator';
8
8
import FormNames from '../../../constants/FormNames' ;
9
+ import userAPI from '../../../api/user' ;
9
10
import { validateForm } from '../../../actions/formActions' ;
10
11
import { pushErrors } from '../../../actions/errorActions' ;
11
12
import { Form , FormField , FormFooter } from '../../utils/BsForm' ;
@@ -59,6 +60,19 @@ class VerifyEmailForm extends Component {
59
60
}
60
61
61
62
_handleSubmit ( formData ) {
63
+ let { dispatch, apiEngine, initialize } = this . props ;
64
+
65
+ return userAPI ( apiEngine )
66
+ . requestVerifyEmail ( formData )
67
+ . catch ( ( err ) => {
68
+ dispatch ( pushErrors ( err ) ) ;
69
+ throw err ;
70
+ } )
71
+ . then ( ( json ) => {
72
+ initialize ( {
73
+ email : '' ,
74
+ } ) ;
75
+ } ) ;
62
76
}
63
77
64
78
_handleCancleClick ( ) {
Original file line number Diff line number Diff line change @@ -34,6 +34,13 @@ export default ({ app }) => {
34
34
validate . verifyUserNonce ( 'verifyEmail' ) ,
35
35
userController . verifyEmail
36
36
) ;
37
+ app . post ( '/api/users/email/request-verify' ,
38
+ bodyParser . json ,
39
+ validate . form ( 'user/VerifyEmailForm' ) ,
40
+ validate . recaptcha ,
41
+ userController . setNonce ( 'verifyEmail' ) ,
42
+ mailController . sendVerification
43
+ ) ;
37
44
app . post ( '/api/users/login' , bodyParser . json , userController . login ) ;
38
45
app . post ( '/api/users/password/request-reset' ,
39
46
bodyParser . json ,
You can’t perform that action at this time.
0 commit comments