Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- map.resource :users,
- :collection => {:reset_password => :get,
- :reset_password => :post}
- # GET /users/reset_password => Renders reset_password screen
- # POST /users/reset_password?email=joe@blow.com => goes back to login screen with flash
- UsersController
- def reset_password
- @user = User.find_by_email(params[:email])
- @user.reset_password!
- respond_to do |format|
- format.html do
- flash[:notice] = "Successfully reset password, check ur email"
- redirect_to login_path
- end
- end
- rescue
- # This should get rendered if there is no email param
- end
Add Comment
Please, Sign In to add comment