Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,410 --> 00:00:09,650
OK, so now that we have our ability to store users, let's actually create our sign up.
2
00:00:10,730 --> 00:00:15,290
We'll go back to our components and we will make our sign up component.
3
00:00:17,000 --> 00:00:25,310
So let's just add the regular files like we always do, sign up component and sign up dot Stiles.
4
00:00:27,380 --> 00:00:27,950
Sarsae.
5
00:00:30,340 --> 00:00:31,750
We are importing react.
6
00:00:35,550 --> 00:00:38,430
And we are going to import our form input.
7
00:00:40,720 --> 00:00:42,940
Because we need our form input.
8
00:00:44,430 --> 00:00:46,560
And we also need our custom button.
9
00:00:50,670 --> 00:00:52,830
And we also need our off.
10
00:00:54,040 --> 00:00:58,240
As well as our create user profile document.
11
00:01:01,420 --> 00:01:02,410
From Firebase.
12
00:01:03,900 --> 00:01:07,260
Because we are creating and authenticating new users.
13
00:01:09,070 --> 00:01:12,070
Now, let's bring in our stylesheet.
14
00:01:14,000 --> 00:01:17,780
And create a stateful class.
15
00:01:18,900 --> 00:01:24,870
Because just like our Sinon, we need to store what the user is typing into our form inputs, so we're
16
00:01:24,870 --> 00:01:26,970
going to have our component.
17
00:01:28,590 --> 00:01:30,270
And we are going to do.
18
00:01:32,090 --> 00:01:36,260
This state is equal to a display name.
19
00:01:37,410 --> 00:01:38,460
Of empty string.
20
00:01:39,420 --> 00:01:40,050
Email.
21
00:01:45,010 --> 00:01:47,470
And then confirm password.
22
00:01:49,970 --> 00:01:54,080
All of empty strength, that's what the user is going to type in to those fields.
23
00:01:55,640 --> 00:02:00,410
Now, what we'll do is we will in our render.
24
00:02:01,890 --> 00:02:06,090
Ranadive, we've got to return and put this in the return.
25
00:02:07,380 --> 00:02:08,310
So we'll have our Divx.
26
00:02:09,910 --> 00:02:13,300
That'll have our class name of sign up.
27
00:02:14,820 --> 00:02:17,010
And inside will be an H2.
28
00:02:18,240 --> 00:02:19,770
With the class name of title.
29
00:02:22,060 --> 00:02:29,440
And it will say I already or so I do not have a account.
30
00:02:31,830 --> 00:02:33,990
And then our span will be.
31
00:02:36,230 --> 00:02:38,120
Sign up with.
32
00:02:39,070 --> 00:02:42,160
Your email and password.
33
00:02:43,700 --> 00:02:45,260
And then we'll have a form.
34
00:02:47,070 --> 00:02:53,400
And just like our son and for form, it's pretty much going to be very similar, right?
35
00:02:53,940 --> 00:02:57,180
Class name, sign up.
36
00:02:58,120 --> 00:02:58,630
Form.
37
00:03:00,180 --> 00:03:06,720
And our on submit will be this function that we will call handle submit, which we haven't written yet,
38
00:03:06,720 --> 00:03:07,530
but we will later.
39
00:03:09,990 --> 00:03:14,790
We need form inputs and we're going to need four of them.
40
00:03:16,160 --> 00:03:22,850
But for now, for this first one, it will be a type of text because this will be the display name.
41
00:03:24,770 --> 00:03:26,960
Name, display, name.
42
00:03:28,690 --> 00:03:33,280
Value, and then we got a D structure off those four values.
43
00:03:34,260 --> 00:03:35,130
From our state.
44
00:03:38,110 --> 00:03:41,650
We need display in an email.
45
00:03:42,710 --> 00:03:45,320
Password and confirm password.
46
00:03:47,680 --> 00:03:51,520
So the value of Passan will be display name.
47
00:03:55,240 --> 00:04:00,130
On change will be a method to handle change that we also need to write.
48
00:04:01,430 --> 00:04:05,630
And then the label will be display name.
49
00:04:06,760 --> 00:04:08,050
And this will be required.
50
00:04:09,720 --> 00:04:12,180
So we just need to duplicate this four times.
51
00:04:13,440 --> 00:04:21,600
Except the second type will be e-mail, because imports have their own e-mail where they require you
52
00:04:21,600 --> 00:04:25,060
to have the at symbol in it in order for it to be a valid email string.
53
00:04:25,770 --> 00:04:26,850
This will be email.
54
00:04:28,310 --> 00:04:30,170
This will also be email.
55
00:04:34,130 --> 00:04:38,420
And the second and third one will be password, and they will automatically hide.
56
00:04:39,790 --> 00:04:41,020
The actual.
57
00:04:42,460 --> 00:04:43,990
Text as the user types in.
58
00:04:48,420 --> 00:04:49,740
And the same for this one.
59
00:04:51,560 --> 00:04:54,680
So we'll call this confirm password.
60
00:05:00,490 --> 00:05:02,170
Confirm password.
61
00:05:05,350 --> 00:05:12,870
Now, if we are missing oh, so we got to make sure that these form inputs are all closing properly.
62
00:05:17,120 --> 00:05:19,490
We need our final custom button.
63
00:05:22,540 --> 00:05:23,530
To be typesof.
64
00:05:27,100 --> 00:05:28,990
Because we just need to trigger the summit.
65
00:05:30,830 --> 00:05:33,590
And then inside, we will say.
66
00:05:35,380 --> 00:05:37,390
Sign up.
67
00:05:41,400 --> 00:05:46,140
And now that we have our component, let's just export default.
68
00:05:50,300 --> 00:05:51,600
And let's write those functions.
69
00:05:52,460 --> 00:05:53,960
Let's start with Handal submit.
70
00:05:55,620 --> 00:06:02,040
Now, handle submit will be an async function that gets the event.
71
00:06:03,550 --> 00:06:08,710
And what we will do is prevent the default submitting, right?
72
00:06:08,740 --> 00:06:12,540
We want to prevent the default action of that a form submit action.
73
00:06:13,360 --> 00:06:22,150
And what we want to do here is we want to do almost the same thing we're doing with our objects when
74
00:06:22,360 --> 00:06:25,480
we had a Google authentication action happen.
75
00:06:25,510 --> 00:06:25,870
Right.
76
00:06:26,320 --> 00:06:30,850
So similar to our apgar's, except this time we are manually creating it.
77
00:06:32,140 --> 00:06:33,370
So how does that work?
78
00:06:34,240 --> 00:06:41,530
Well, first we are going to check if password and the confirm password don't match, because if they
79
00:06:41,530 --> 00:06:43,200
don't match, then we don't want to proceed.
80
00:06:44,230 --> 00:06:48,520
So we want to just alert that passwords don't match.
81
00:06:50,290 --> 00:06:52,500
Let's just use a double quotes here.
82
00:06:55,700 --> 00:07:01,430
And then we will return from this whole function because we don't want to do anything else if their
83
00:07:01,430 --> 00:07:03,350
passwords don't match, we want them to fix that.
84
00:07:05,480 --> 00:07:08,720
Then we are going to do a try catch block.
85
00:07:11,050 --> 00:07:18,370
And inside of our tri, we're going to use a new auth method that comes with that odd library, and
86
00:07:18,370 --> 00:07:23,410
what we're going to say is we're going to get yuzu, right?
87
00:07:23,410 --> 00:07:30,970
We're going to destructo to the user off the return of the wait for off dot create user with email and
88
00:07:30,970 --> 00:07:31,580
password.
89
00:07:32,080 --> 00:07:38,590
So this one creates, as we read right there in that little dropdown, creates a new user account associated
90
00:07:38,590 --> 00:07:42,560
with the specific email address and password.
91
00:07:42,580 --> 00:07:48,880
Right now, once this is successful, the user gets assigned to our application from the authentication
92
00:07:48,880 --> 00:07:52,150
and then it gives us back a user auth object.
93
00:07:52,630 --> 00:07:59,920
But that user off object is on the key user, which is why we want to do that structure that way.
94
00:08:00,790 --> 00:08:04,840
So create user with email and password and then we'll pass it.
95
00:08:04,840 --> 00:08:08,530
The email and password that we have just this structure off our state.
96
00:08:09,820 --> 00:08:19,450
Once we get that back, we want to run our create user profile document method with the user and the
97
00:08:19,450 --> 00:08:24,700
display name value, which chozen as an object right where the name goes to the value.
98
00:08:26,950 --> 00:08:32,440
And then if there's an error, we want to console error the error.
99
00:08:32,950 --> 00:08:37,960
So if anything happens in that process, whether it can't fetch it or it can't create it, we want to
100
00:08:37,960 --> 00:08:38,520
throw an error.
101
00:08:39,460 --> 00:08:43,240
If this succeeds right, then we want to reset our state.
102
00:08:43,570 --> 00:08:45,730
So we're going to wait for this to finish.
103
00:08:46,720 --> 00:08:54,670
And when it does, then we will run this set state and we want to set our state equal to.
104
00:08:56,320 --> 00:08:58,660
Our initial state where everything is empty.
105
00:09:02,380 --> 00:09:03,190
And now.
106
00:09:04,440 --> 00:09:11,040
After this, we want to write our handle change and our handle change method is going to look almost
107
00:09:11,040 --> 00:09:12,660
identical to our Sinon one.
108
00:09:13,590 --> 00:09:19,920
We are just going to structure off of the event the name and the value from the target.
109
00:09:21,830 --> 00:09:24,290
And then we're just going to set St..
110
00:09:26,000 --> 00:09:30,020
And dynamically set the name Valette to the value value.
111
00:09:32,240 --> 00:09:33,560
And this has to be an object.
112
00:09:36,970 --> 00:09:42,680
OK, now that our sign up component is finished, let's just apply the styles.
113
00:09:43,630 --> 00:09:46,360
So what we'll do is very similar to Sinon.
114
00:09:46,750 --> 00:09:55,000
We'll say display flex flex direction of column, because we want all those elements vertically aligned.
115
00:09:55,000 --> 00:09:55,230
Right.
116
00:09:55,780 --> 00:09:58,780
And then we'll set the width to three, 80 pixels.
117
00:09:59,290 --> 00:10:06,400
And then on the title will set a margin of 10 pixels, top bottom and zero pixels left and right.
118
00:10:07,520 --> 00:10:12,830
And now let's bring our sign up component into our sign it and sign up page.
9962
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.