No, this is not a real Sinatra error :).
This is the personal homepage of Elad Meidar, a web developer and an entrepreneur specializing in Ruby on Rails. I hang around in Israel, and i am currently having the best time of my life over at Fiverr.com
I am a proud member of RailsBridge, Helping new Rails developers get into our world and also contributed a few Patches to the Ruby on Rails core.
In the last post we added some functionality to our authentication system. We added a “Remember me” functionality to allow users to log in using a cookie and we also added an activation process that authenticates the email address we get from the user.
On this post, i’ll cover password resets:
The logic behind a password reset process is rather simple, basically it is very similar to the activation process we did before.
First, we are going to add a field that will contain that reset token, and a method to generate it when required:
That’s basically it.
We need to add a few actions:
#updateaction because we need a little different behavior that i think is enough to justify a separate action: First we need to find the user record based on a token not by
idand second, we need to use our
logout_keeping_sessionto make sure no malicious changes are made to a logged in user if it exists.
The process will work like that:
UsersController#send_password_resetwill generate a new reset token and send the user with reset instructions.
UsersController#reset_passwordthat will match the reset token from the URI to a specific user on the system and allow the user to enter a new password if matched.
Here’s the current
Source for the UsersController#forgot_password view, UsersController#send_password_reset view, “UserMailer model”http://gist.github.com/325983, Reset instructions mail template and UsersController#reset_password added.
Again, it seems that we tackled most of the problems we had with Mongoid in the early stages and practically nothing bothered us too much since the first part of this series.
I keep the implementation of a background processor until a bit later, it is not that important at this stage so we’ll get back to it later.
You're seeing this error because I think it is funny.