This course will be retired on June 1, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
Let's walkthrough the changes that we made in this section.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Adding support for user sign in and
0:00
sign out brings us one step closer to
fully implementing user authentication.
0:01
Let's walk through the changes
that we just made.
0:07
Here's our solution in Visual Studio.
0:10
I'll press F5 to start debugging.
0:12
Now that we've restricted
access to our default route,
0:16
which maps to the entry's list page,
we're redirected to the Sign In page.
0:20
Let's test our client-side validation.
0:25
I won't provide any values, and
I'll click the Sign In button.
0:28
And we see our required field validations
for both the Email and Password fields.
0:31
Next, I'll provide a string that
isn't a valid email address, and
0:37
I'll provide my password.
0:43
And click Sign in.
0:47
Now we're seeing that the Email
field is not a valid e-mail address.
0:49
So let me fix that.
0:53
Now we're getting green check marks.
0:57
I'm gonna change my password
to an invalid password.
0:59
Then I'll click Sign In.
1:04
And we get an error message
back that lets us know
1:07
that it was an invalid login attempt.
1:10
This time, I'll provide my correct
password and click Sign In.
1:14
Our login is successful this time,
1:21
and we're redirected back
to the Entries list page.
1:23
Here's my username which is my email
address displayed to the left of the menu.
1:27
Let's make sure that we can
still get the Add Entry page.
1:33
Okay, that looks good.
1:37
And then, let's sign out.
1:40
And we're redirected
back to the Sign In page.
1:44
Well actually,
from the Sign Out action method,
1:47
we were redirected to
the Entries list page first.
1:50
But since we were no longer authenticated,
1:53
we were then redirected
to the Sign In page.
1:55
Next up, we'll fix our entry data so
that it's segmented by user.
1:59
When we're done with that change, a user,
2:04
after they've signed in,
will only see their own entries.
2:06
Then we'll see how we can protect
the user's data to ensure
2:10
that another user can't access it or
make changes to it.
2:13
See you after the break.
2:17
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up