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 11import { browserHistory } from 'react-router' ;
2+ import { FORM_ERROR } from 'final-form' ;
23import * as ActionTypes from '../../constants' ;
34import apiClient from '../../utils/apiClient' ;
45import { showErrorModal , justOpenedProject } from '../IDE/actions/ide' ;
@@ -61,8 +62,7 @@ export function validateAndLoginUser(formProps) {
6162 } )
6263 . catch ( ( error ) =>
6364 resolve ( {
64- password : error . response . data . message ,
65- _error : 'Login failed!'
65+ [ FORM_ERROR ] : error . response . data . message
6666 } )
6767 ) ;
6868 } ) ;
Original file line number Diff line number Diff line change @@ -19,7 +19,13 @@ function LoginForm(props) {
1919 validate = { validateLogin }
2020 onSubmit = { onSubmit }
2121 >
22- { ( { handleSubmit, pristine, submitting, invalid } ) => (
22+ { ( {
23+ handleSubmit,
24+ submitError,
25+ pristine,
26+ submitting,
27+ modifiedSinceLastSubmit
28+ } ) => (
2329 < form className = "form" onSubmit = { handleSubmit } >
2430 < Field name = "email" >
2531 { ( field ) => (
@@ -59,7 +65,10 @@ function LoginForm(props) {
5965 </ p >
6066 ) }
6167 </ 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 } >
6372 { props . t ( 'LoginForm.Submit' ) }
6473 </ Button >
6574 </ form >
You can’t perform that action at this time.
0 commit comments