Building Data-Driven Web Apps with Pyramid and SQLAlchemy Transcripts
Chapter: User input and HTML forms
Lecture: Login form
0:00 Have the logic for login in in place.
0:02 We think. Haven't been able to test it yet.
0:04 Cause we have no log in form.
0:06 Let's do that real quick.
0:07 Over here in register, we honestly have basically
0:10 exactly what we need, minus one field so
0:13 let's just take that and put it over in login.
0:19 So put that there. We don't need the name.
0:22 Change this to login.
0:26 Think we're good. Let's try it.
0:29 I'm also not including the proper CSS.
0:36 So down here. After this one.
0:43 Alright login looks good.
0:44 We should totally make it look better but
0:47 user can not be found or the password was incorrect.
0:51 Well, let's try this with some data.
0:55 The letter a. Nope, still didn't work.
0:58 Let's try it with the actual log in details, ready?
1:02 Boom. Wow. Login is working. That's sweet.
1:05 So let's just go review real quick.
1:07 So over here, obviously this shows the form and
1:10 there is nothing super interesting there at this point.
1:13 But this is what is processing the POST. We get the email.
1:16 We don't bother checking that the email and password exist
1:18 because this will fail if they don't. Obviously.
1:22 I can feel further reasons
1:23 like they put in the wrong password or the wrong email.
1:25 But that certainly will fail if these are missing.
1:27 So that's sort of our double check right there.
1:30 For whatever reason
1:32 the value doesn't come back from the database we say
1:35 the user couldn't be found and we already saw that.
1:37 But if there is a user, we did a proper log in, then boom.
1:41 We over at account.