File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 1
1
import { browserHistory } from 'react-router' ;
2
+ import { FORM_ERROR } from 'final-form' ;
2
3
import * as ActionTypes from '../../constants' ;
3
4
import apiClient from '../../utils/apiClient' ;
4
5
import { showErrorModal , justOpenedProject } from '../IDE/actions/ide' ;
@@ -61,8 +62,7 @@ export function validateAndLoginUser(formProps) {
61
62
} )
62
63
. catch ( ( error ) =>
63
64
resolve ( {
64
- password : error . response . data . message ,
65
- _error : 'Login failed!'
65
+ [ FORM_ERROR ] : error . response . data . message
66
66
} )
67
67
) ;
68
68
} ) ;
Original file line number Diff line number Diff line change @@ -19,7 +19,13 @@ function LoginForm(props) {
19
19
validate = { validateLogin }
20
20
onSubmit = { onSubmit }
21
21
>
22
- { ( { handleSubmit, pristine, submitting, invalid } ) => (
22
+ { ( {
23
+ handleSubmit,
24
+ submitError,
25
+ pristine,
26
+ submitting,
27
+ modifiedSinceLastSubmit
28
+ } ) => (
23
29
< form className = "form" onSubmit = { handleSubmit } >
24
30
< Field name = "email" >
25
31
{ ( field ) => (
@@ -59,7 +65,10 @@ function LoginForm(props) {
59
65
</ p >
60
66
) }
61
67
</ Field >
62
- < Button type = "submit" disabled = { submitting || invalid || pristine } >
68
+ { submitError && ! modifiedSinceLastSubmit && (
69
+ < span className = "form-error" > { submitError } </ span >
70
+ ) }
71
+ < Button type = "submit" disabled = { submitting || pristine } >
63
72
{ props . t ( 'LoginForm.Submit' ) }
64
73
</ Button >
65
74
</ form >
You can’t perform that action at this time.
0 commit comments