thingspeak/app/controllers/mailer_controller.rb
Alan Bradburne 4f0354303f Improve channel, user and api_key models with basic scopes, correct references and protect attributes.
Simplify channels & user controllers and models, moving code to the models.
Remove catch-all route and ensure all actions are specified, fixing url paths.
Change clone to dup in feed_controller as using clone seems to affect the cloned object (problem only in ruby 1.9.3?)
2012-02-09 23:42:16 +00:00

21 lines
550 B
Ruby

class MailerController < ApplicationController
def resetpassword
@user = User.find_by_login_or_email(params[:user][:login])
if @user.nil?
session[:mail_message] = t(:account_not_found)
else
begin
@user.reset_perishable_token!
# Mailer.password_reset(@user, "https://www.thingspeak.com/users/#{@user.id}/reset_password?token=#{@user.perishable_token}").deliver
session[:mail_message] = t(:password_reset_mailed)
rescue
session[:mail_message] = t(:password_reset_error)
end
end
redirect_to login_path
end
end