Python for Entrepreneurs Transcripts
Chapter: Sending and receiving email
Lecture: Demo: Emailing the reset code

Login or purchase this course to watch this video and the rest of the course contents.
0:01 Alright, it's time to actually send this email instead of just print it out,
0:04 let's say EmailService.send, we have these various things here,
0:08 let's do send_password_reset.
0:16 And what do we got to pass, we are going to need to pass the email,
0:19 and the reset code.
0:22 And we don't need to pass the whole thing, we can just pass the reset.id,
0:25 so let's generate this method.
0:31 OK, now it's going to be very similar to this one,
0:34 so I'll just copy that really quickly, and instead of sending welcome
0:39 we are going to send password_reset, reset password, which I have already done,
0:43 it's got the email, I don't think we actually we need the email in that part of it,
0:49 what we need is the rest code, let's just double check that really quick,
0:55 we need the reset code, so here this goes like this,
0:59 and we have the rest.id, then we'll say... this is going to be "reset your password...",
1:05 it's kind of a long title but we are going to go with it.
1:11 OK, let's see what we get here.
1:15 Let's go over here and generate yet another reset,
1:19 this time it's a little because it's actually sending the email,
1:22 you can see down here, "Sending message (live!)" and then boom,
1:26 it says we would have send it, that's left over, we actually did send it,
1:29 let me check my email,
1:32 hey look what we found in our email. "Reset your password",
1:35 and here you can see the URL, let me hover over this,
1:39 shows you some great long code, reset password and I put local host,
1:43 please don't really put local host in yours,
1:45 but so I could do the demo without doing some kind of deployment, here we go,
1:48 so if I click this, it should take us back to our app with this "Reset your password".
1:53 Now in the next video I am going to come back
1:55 and actually use that code right there to validate and perform the reset.
1:59 And that will wrap up everything to do with the password resets.