1
00:00:00,660 --> 00:00:07,020
So we have this login form and now we want this to display when people click on the login link, and

2
00:00:07,020 --> 00:00:07,680
that's pretty easy.

3
00:00:07,800 --> 00:00:11,520
But first I see that I didn't change this to password.

4
00:00:12,720 --> 00:00:18,400
So the four part of the four attribute of the label tag should have been for password, and it is now.

5
00:00:19,110 --> 00:00:26,550
So if you recall, we actually in our base layout, which is right here, we set up a route that's going

6
00:00:26,550 --> 00:00:28,020
to be user login.

7
00:00:28,020 --> 00:00:29,520
So we need to create a route for that.

8
00:00:29,520 --> 00:00:33,030
And then we need to create a handler and then we need to display this login page and we know how to

9
00:00:33,030 --> 00:00:33,360
do that.

10
00:00:33,960 --> 00:00:39,780
So let's open our routes file and let's put it right down here.

11
00:00:40,530 --> 00:00:48,900
Mux doGet and the path is slash user slash login and it will go to handler stort repo dot show login,

12
00:00:49,290 --> 00:00:51,290
which doesn't exist, but we can do that right now.

13
00:00:51,300 --> 00:00:55,890
So let's go to our handler page, which is under packages.

14
00:00:58,340 --> 00:01:05,750
Handlers, handlers, dutko, and at the very bottom, I will simply put in a new function that has

15
00:01:05,750 --> 00:01:07,730
a receiver of the repository type.

16
00:01:10,160 --> 00:01:18,500
And I'll call that show Log-in, and it will take, as do all handlers, as all handlers do, a response

17
00:01:18,500 --> 00:01:18,860
writer.

18
00:01:22,100 --> 00:01:26,090
And a pointer to an HTTP request.

19
00:01:26,750 --> 00:01:32,270
OK, and all I want that to do right now is just to show that login page and we know how to do that.

20
00:01:32,270 --> 00:01:40,430
We can just go render DOT template and it requires a W and R the template string, which I called log

21
00:01:40,430 --> 00:01:45,320
in page dot temple and for now I'll give it an MTD.

22
00:01:46,580 --> 00:01:55,640
So models template data analyst, leave that empty and that should be enough to render this template.

23
00:01:55,670 --> 00:01:57,230
So let's stop our application.

24
00:01:57,230 --> 00:02:01,790
If it's running, clear it, run it and make sure this actually works.

25
00:02:03,890 --> 00:02:10,600
Back to my Web browser, reload the page to make sure everything's current and there it's not working,

26
00:02:10,610 --> 00:02:14,570
user log in, excreting content, no pointer.

27
00:02:14,570 --> 00:02:16,020
Oh yes, I'm going to give it an empty form.

28
00:02:16,040 --> 00:02:22,190
OK, so let's go back to our login handler, which is over here and give it an empty for.

29
00:02:23,400 --> 00:02:27,480
Form form new Nhill.

30
00:02:29,280 --> 00:02:30,490
Stop the application.

31
00:02:30,690 --> 00:02:37,650
Start the application and let's try that again, reload this page and there's my login form, not very

32
00:02:37,650 --> 00:02:39,630
pretty, but we can make it prettier later.

33
00:02:39,690 --> 00:02:40,050
All right.

34
00:02:40,050 --> 00:02:41,020
So that gets that going.

35
00:02:41,340 --> 00:02:46,020
Now, we need to think about what happens when someone actually fills this form out.

36
00:02:46,020 --> 00:02:47,820
We need to authenticate the user.

37
00:02:48,390 --> 00:02:51,720
And, of course, we're going to do that using our user table in the database.

38
00:02:51,960 --> 00:02:55,890
And we have some work that we have to do before we can actually do that authentication.

39
00:02:55,890 --> 00:02:57,990
And we'll take care of that in the next lecture.
