Anderson, we are going to create a lot in Asia because at this moment, this just has the worst loss
in.
And actually, we can copy the.
Satchel A and then to a lot in and then we paid.
We have the site apage and we karate's.
At Lockin and of course, this would be lower case.
So now.
We have to go to fix these.
We have to go to fix the law in API, so we back to the server and go to the controller and at this
moment you can see the log in just has this function which send the word login and.
We want to have to use that information, however, we do not have function for Mongoose, but we can
create it by ourselves.
So we go to the user and then type users schema.
Static.
In.
Is equal to the eating functions.
Email, password.
And I what we are going to do it first.
We are going to check whether there is a user access.
So we.
Has to let the constant USA is equal to await.
And then please don't buy one, and then we pass that email, so we search by email, and then if you
use it here, we will do something.
For example, we are going to compare with the password and then if there's no use, there are going
to throw the era incorrect email and then we are going to compare the password.
So we are going to create a Clinton and then you authenticate it is equal to a week and then we use
the microchip to compare the password.
First we are going to compare the password that they use to type in and then we are going to post the
value of the hash, the password, which is goozner password, and then we are going to check if it
is authenticated so it is authenticated, you may return the user, otherwise we will throw the error.
Incorrect password.
Next, we are going to fix the login API.
So we go to the controller and then we can copy it from the site up.
And then we proceed at a lot in page three paces to the log in API and since we do not have to name
so we can delete this one and also this one.
And of course we do not have to create we are going to use login, so we change these to log in.
And this has to the out because we used to wait, so we had to add anything here.
And besides of this, we had to go to activate this alert area functions, because if you remember this
error message, this error message is from the mongoose meditation's.
And now we are going to use these frontera.
So we have to handle it separately.
So we back to the alert area functions and we are going to check if the error message.
Now, we can go to try to prop up the error message and error again.
So if we type where we send and we are going to type a wrong password and we Trixi up now, it has to
era and you look at this, I find is something wrong here, because for the lot in we are not going
to pass the object.
We are going to pass the email and password.
So for the off contract, we have to delete this credit record.
And then we go to the and then we go to the alert error and then we try to sign up.
Actually, this should be locked in.
We can fix these.
And a lot in Page and I, we change this button, as in now we try to lock in.
And see where there is error here and the error message is incorrect, IMO, which is pop up from the
user model.
We can see this error message.
So for the alert error function, we are going to check if error message is equal to this and we are
going to accept the error.
Email is Icko to this email mail.
And then we also duplicate to see if the error message is equal to incorrect password.
Then the error stop password.
Is equal to the password is being correct.
Now we go to try again and not in, you can email Laffont.
And also, if we go to use a real icon.
And with the correct password, all we try to use the incorrect password, you can see the password
used incorrect pop up, and now we typed the correct password and kicked in.
And you will go to the home page and now you can chat with other people.
And the last thing is inside the log in page.
We should not have the name field, so we have to go to back to the kind of site login page and delete
the row about name.
So now we can login with these login page.