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, let's say EmailService.send, we have these various things here,
0:09
let's do send_password_reset. And what do we got to pass, we are going to need to pass the email, and the reset code.
0:23
And we don't need to pass the whole thing, we can just pass the reset.id, so let's generate this method.
0:32
OK, now it's going to be very similar to this one, so I'll just copy that really quickly, and instead of sending welcome
0:40
we are going to send password_reset, reset password, which I have already done,
0:44
it's got the email, I don't think we actually we need the email in that part of it,
0:50
what we need is the rest code, let's just double check that really quick, we need the reset code, so here this goes like this,
1:00
and we have the rest.id, then we'll say... this is going to be "reset your password...", it's kind of a long title but we are going to go with it.
1:12
OK, let's see what we get here. Let's go over here and generate yet another reset, this time it's a little because it's actually sending the email,
1:23
you can see down here, "Sending message (live!)" and then boom, it says we would have send it, that's left over, we actually did send it,
1:30
let me check my email, hey look what we found in our email. "Reset your password", and here you can see the URL, let me hover over this,
1:40
shows you some great long code, reset password and I put local host, please don't really put local host in yours,
1:46
but so I could do the demo without doing some kind of deployment, here we go,
1:49
so if I click this, it should take us back to our app with this "Reset your password". Now in the next video I am going to come back
1:56
and actually use that code right there to validate and perform the reset. And that will wrap up everything to do with the password resets.