So now we need to turn our attention to secure user authentication, and what I want to do is to extend
our application such that property owners are able to log in securely using best practices to look at
reservations and bookings and to modify them and everything else they need to do.
So the first thing we're going to have to have, obviously, is some means of logging in.
So what I'm going to do, I have our application running here is I'm going to put a log in a link here,
and that will take us to a page that allows the user to fill out a form to log in.
So let's get started with that.
This is an easy step.
So the first thing I'll do is look at my base layout, which is something that appears on every page
of the public facing site.
And I'll scroll down to the menu part and I will simply copy this and paste it here and change the path
to a route that doesn't exist yet.
I'll call it user log in and I'll change the name to log in.
And when I save that and come back here and reload the page, now I have a log in like it doesn't work
yet.
And there's going to have to be some work here.
Of course, when somebody is actually logged in, which we haven't done yet, that log in should change
to log out and then once they're logged out, it should change back to log in.
So obviously that's something we're going to have to do.
We also need to have a page with a form that lets you log in.
Well, we can make the page right now.
Let's go do that.
So in my templates, I'll create a new page or a new file, which I'll just call log in page tempo and
yes, add that to it.
And for the sake of making this pretty fast, I will copy the about page pasted in here and replace
this content with a form.
So is there anywhere I already have a form I can copy and paste from.
Yes, there is.
Make reservation.
So let's copy this bit right here.
The first part.
And go back here to my login page and replace the title with log in.
And the whole thing has to be wrapped in a form tag, so I'll put the form tag in and just paste this
in and I will change the login from first name, because you don't want people logging in by first name.
You want a unique user ID and the unique user I.D., the easiest one to use.
And the vast majority of the site to do this is to use an email address.
So I'll change this to email and call this email and call this email and leave that alone.
And this has to be email.
The type will be email and will leave this empty.
No value in there at all right now and call this email and this email and I think that's it for that
one.
And then we can copy the whole thing and put it in a place for their password.
We don't need to merge.
And top three.
So I'll get rid of that and I'll call this password.
And this password copy
and paste and paste and paste, and the tape is not going to be text or email, it will be password.
All right.
That should be enough for that.
Now, after this is all done, of course, we'll need an H.R. tag just to make it look good and a button
that allows them to log in input type equals button or submit.
Class equals button button primary and value equals submit.
All right, so that gives us a basic form and there's no error checking on this yet, but we'll get
to that before too long.
Right now, all I've done is created a link and created a page.
And now we need to create the necessary handlers.
And there's a fair bit of work required to make this all as secure as it needs to be.
So we'll get started on that in the next lecture.