Building Data-Driven Web Apps with Pyramid and SQLAlchemy Transcripts
Chapter: User input and HTML forms
Lecture: Login form

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Have the logic for login in in place. We think. Haven't been able to test it yet. Cause we have no log in form. Let's do that real quick.
0:08 Over here in register, we honestly have basically exactly what we need, minus one field so let's just take that and put it over in login.
0:20 So put that there. We don't need the name. Change this to login. Think we're good. Let's try it. I'm also not including the proper CSS.
0:37 So down here. After this one. Alright login looks good. We should totally make it look better but user can not be found or the password was incorrect.
0:52 Well, let's try this with some data. The letter a. Nope, still didn't work. Let's try it with the actual log in details, ready?
1:03 Boom. Wow. Login is working. That's sweet. So let's just go review real quick. So over here, obviously this shows the form and
1:11 there is nothing super interesting there at this point. But this is what is processing the POST. We get the email.
1:17 We don't bother checking that the email and password exist because this will fail if they don't. Obviously. I can feel further reasons
1:24 like they put in the wrong password or the wrong email. But that certainly will fail if these are missing.
1:28 So that's sort of our double check right there. For whatever reason the value doesn't come back from the database we say
1:36 the user couldn't be found and we already saw that. But if there is a user, we did a proper log in, then boom. We over at account.

Talk Python's Mastodon Michael Kennedy's Mastodon