@@ -222,8 +222,15 @@ class Forms extends Component {
222
222
this . setState ( { selectedModal : e . target . id } )
223
223
}
224
224
}
225
+ UNSAFE_componentWillReceiveProps ( newProps ) {
226
+ const { volunteer, err } = newProps
227
+ this . setState ( { err, volunteer } )
228
+ const { userId } = this . props . match . params
229
+ if ( userId && err === 'An account with this email address already exists' ) {
230
+ this . setState ( { showEmailBox : true } )
231
+ }
232
+ }
225
233
render ( ) {
226
- const { err, volunteer } = this . props
227
234
const {
228
235
disabled,
229
236
agreeToTOU,
@@ -233,7 +240,9 @@ class Forms extends Component {
233
240
agreeToReceiveCommunication,
234
241
showEmailBox,
235
242
msg,
236
- loading
243
+ loading,
244
+ err,
245
+ volunteer
237
246
} = this . state
238
247
if ( loading ) {
239
248
return (
@@ -275,21 +284,24 @@ class Forms extends Component {
275
284
</ div >
276
285
)
277
286
}
278
- if ( userId && showEmailBox ) {
279
- return (
280
- < div className = "form-container container" >
281
- { this . state . err && < p className = "errors" > { this . state . err } </ p > }
287
+ return (
288
+ < div className = "form-container container" >
289
+ { err && (
290
+ < p className = "errors" >
291
+ { err }
292
+ { window . scrollTo ( 0 , 0 ) }
293
+ </ p >
294
+ ) }
295
+ { showEmailBox ? (
282
296
< div className = "forms-important-box" >
283
297
< div >
284
298
< p >
285
- < strong > Important: </ strong > This form will send you an email
286
- with a link to update your existing profile to alow us to see
287
- your request to access admin dashboard.
299
+ < strong > Important: </ strong > this form will send you a
300
+ verification email before getting access to our dashboard
288
301
</ p >
289
302
< p >
290
303
< strong >
291
- Please entre the email you used for volunteer application form
292
- and click submit.
304
+ Please enter your email you used and click submit
293
305
</ strong >
294
306
</ p >
295
307
< form
@@ -315,50 +327,45 @@ class Forms extends Component {
315
327
</ span >
316
328
</ div >
317
329
</ div >
318
- </ div >
319
- )
320
- }
321
- return (
322
- < div className = "form-container container" >
323
- < Header
324
- err = { err || this . state . err }
325
- formInComplete = { formInComplete }
326
- userId = { userId }
327
- />
328
- { userId && (
329
- < div className = "forms-important-box" >
330
- < span >
331
- < strong > Important:</ strong > If you already completed this form in
332
- some point please click{ ' ' }
333
- < span
334
- style = { { cursor : 'pointer' , color : '#0053ff' } }
335
- onMouseDown = { ( ) => this . setState ( { showEmailBox : true } ) }
330
+ ) : (
331
+ < div >
332
+ < Header formInComplete = { formInComplete } userId = { userId } />
333
+ { userId && (
334
+ < div className = "forms-important-box" >
335
+ < span >
336
+ < strong > Important:</ strong > If you already completed this form
337
+ in some point please click{ ' ' }
338
+ < span
339
+ style = { { cursor : 'pointer' , color : '#0053ff' } }
340
+ onMouseDown = { ( ) => this . setState ( { showEmailBox : true } ) }
341
+ >
342
+ here
343
+ </ span >
344
+ .
345
+ </ span >
346
+ </ div >
347
+ ) }
348
+ < form className = "mb-4" onSubmit = { this . handleSubmit } method = "post" >
349
+ < Inputs
350
+ onChange = { this . onChange }
351
+ telOnChange = { this . telOnChange }
352
+ onChangeCheckList = { this . onChangeCheckList }
353
+ { ...this . props }
354
+ { ...this . state }
355
+ />
356
+ < Acknowledgement onChange = { this . onChange } { ...this . state } />
357
+ < button
358
+ disabled = {
359
+ disabled || ! agreeToTOU || ! agreeToReceiveCommunication
360
+ }
361
+ className = "btn volunteer-submit-btn"
362
+ type = "submit"
336
363
>
337
- here
338
- </ span >
339
- .
340
- </ span >
364
+ Submit
365
+ </ button >
366
+ </ form >
341
367
</ div >
342
368
) }
343
- { ! showEmailBox && (
344
- < form className = "mb-4" onSubmit = { this . handleSubmit } method = "post" >
345
- < Inputs
346
- onChange = { this . onChange }
347
- telOnChange = { this . telOnChange }
348
- onChangeCheckList = { this . onChangeCheckList }
349
- { ...this . props }
350
- { ...this . state }
351
- />
352
- < Acknowledgement onChange = { this . onChange } { ...this . state } />
353
- < button
354
- disabled = { disabled || ! agreeToTOU || ! agreeToReceiveCommunication }
355
- className = "btn volunteer-submit-btn"
356
- type = "submit"
357
- >
358
- Submit
359
- </ button >
360
- </ form >
361
- ) }
362
369
</ div >
363
370
)
364
371
}
0 commit comments