Spring '23 Week 12

YouTube Video

Resources

Video Script

Hello, and welcome to the week 12 enhancements video for CC 515 in spring 2023. So you should have completed milestone for last week. So hopefully that’s going well, this week. And next week, you’ll be working on the week six lessons in Canvas, which does a lot of different things. And then you’ll have milestone five, which is due April 24.

So the week six lessons allow us to build out our web framework a little bit more deeply, we’re going to add a lot of features to our web framework, including authentication, we’re going to add interacting with some web API’s, we’re going to learn about web hooks and formal web frameworks. And you’ll continue to build that blog tutorial. And so a lot of the code that we’re doing for the blog tutorial, you’ll be able to bring over to your milestone project and actually use that as part of that project as well. So make sure you’re really paying attention to the blog tutorial and understanding what all that code does, and thinking about how you can adapt that code to work in different ways.

So for the fifth milestone for our project, the big thing we’re going to do is we’re going to add authentication. So we’re going to need routes for login and logout and creating user and registering your user. We’re also going to protect some routes so that only authenticated users can perform certain actions. And so this will actually link the request that the user makes to the user itself in the database. So you’ll have to actually go in and make some database changes as well. So this is a pretty beefy milestone. It’s one of the larger projects that we work on throughout this semester. But hopefully it makes sense. To make this milestone a little bit easier. Below this Announcements video, you’ll see me doing a quick walkthrough of my model solution for milestone five, just so you can get a visual idea of what the functionality should be and what the different features look like. Your project doesn’t have to look like mine, but it gives you an idea of the functionality that we’re looking at as you go through and read the milestone description.

So as always, if you have any questions, feel free to keep in touch you can find me on Discord you can reach out to me during tea time or schedule a one on one office hour with me. I’m always happy to help. But hopefully things are going well you’re going to be adding some authentication so hopefully you know not to use a password like 12345 That’s the same as on my luggage too. But if you have any questions, let me know otherwise, I will probably post another Announcements video in a couple of weeks. Best of luck.

Milestone 5 Overview

YouTube Video

Video Script

Good morning, everyone, I wanted to take a minute to go through my mobile solution of milestone five, just so you can get an idea of what the functionality should look like. I hope this gives you a better idea of exactly all the steps you need to work on to get this milestone completed. So the big thing we’re adding in this milestone is user accounts and sessions. So what I’ve done here, on my homepage, I’ve added a little layout bar at the top that keeps track of my homepage, it also has buttons for creating an account and logging in. And then of course, if I click on any of the other pages, that bar will stay at the top of my window, so that it’s really easy to keep track of whether you’re logged in or not. So the first step I can go through is creating an account. So I’ll click this button, it’ll ask me for an email address and a name, and then a password. And then I will submit that, and it will submit and it will automatically log me in as that user after I submit it, you don’t have to do that. But that’s usually good practice. Then once I’m logged in, you can see my names up there, my name will stay up there as I jump back and forth between pages. And then I can click this logout button, and it will go back to say Create account and login. So I’ll click login again, I will log in as me, hit submit, and we’re good to go. So login and logout works. The biggest thing to keep in mind when you’re logged out, is now we don’t want people to be able to add requests unless they’re logged in. So I’ve got a button down here that says login to add requests, I can click on that, just like before I can log in, it will log me in, I can go to that page. And now I can submit a request. So I’m going to submit a request for bird seed. Hit submit, we see that that goes in, we see that I’m still logged in, so I can add more requests if I want to. But when I log out, we’ll see that that request is still there. But I now can’t add any more requests without logging in. So that’s the basic core of the functionality that you need. For milestone five, you need to be able to get user accounts working. So you’ll need sessions, you’ll need a user’s table, you’ll need a login and a logout route, you’ll also need a signup route. And then you’ll need to protect some of these routes so that you can’t actually add requests unless you’re logged in. One thing that a lot of students do incorrectly is they remove the ability to add requests here via this form. But they don’t actually protect the post route, I will be testing the post route, even outside of your form, I’m going to use a tool called postman to try and post to your website while I’m logged out, and it had better not work. So make sure that you’re properly protecting that route using your sessions so that you can’t post even if this form is missing. So the other thing I want to show really quickly is what the database looks like. So we haven’t talked about this a whole lot. But if you want to encode do, you’ve got the SQL lite three command. So you can use that to open up your database just by loading the database file like this. So once I open up the database, there’s a couple of things I can do to make the output a little bit easier. I’m going to set the mode to columns. And then I’m going to set the headers on. And now if I do tables, I shouldn’t see the tables. And then I should be able to do select star from users. And it will give me all of the users in the database, you can see the user that I just added right here, which is really nice. I can also do select star from requests. And this will show me the requests. And you can see the requests for bird see they added right here has a column for user ID that matches the ID in the users table. And so this is also really important for you to do, it’s not going to be visible on your actual website unless you make it that way. The Milestone doesn’t require you to do that. But if you want to say, you know, birdseed requested by user, you can do that. But I’m going to be checking in your database to make sure that it’s filling out this user ID column correctly as well. This fulfilled column that’s what we’re going to work on in milestone six. So that’s a quick overview of what milestone five looks like. If you have any questions about this, let me know it’s not it’s hopefully not so bad now that you’ve gotten past milestone four, but there are several routes and layouts that you’ll need to work on here. And then milestone six is a doubly double sized milestone. It’s two weeks, it’s 200 points. So make sure you take a look at that. You hopefully should have plenty of time to work on that because there’s really only one week of content left after this one. As always, if you have questions, let me know I’ll post another Announcements video on Monday. But good luck this weekend on milestone five and I will see you on Monday.

Subsections of Spring '23 Week 12