2011-03-27 22:56:15 +02:00
|
|
|
class MailerController < ApplicationController
|
|
|
|
|
|
|
|
def resetpassword
|
|
|
|
@user = User.find_by_login_or_email(params[:user][:login])
|
2012-02-10 00:42:16 +01:00
|
|
|
|
2011-03-27 22:56:15 +02:00
|
|
|
if @user.nil?
|
|
|
|
session[:mail_message] = t(:account_not_found)
|
|
|
|
else
|
|
|
|
begin
|
|
|
|
@user.reset_perishable_token!
|
2012-02-10 00:42:16 +01:00
|
|
|
# Mailer.password_reset(@user, "https://www.thingspeak.com/users/#{@user.id}/reset_password?token=#{@user.perishable_token}").deliver
|
2011-03-27 22:56:15 +02:00
|
|
|
session[:mail_message] = t(:password_reset_mailed)
|
|
|
|
rescue
|
|
|
|
session[:mail_message] = t(:password_reset_error)
|
|
|
|
end
|
|
|
|
end
|
2012-02-10 00:42:16 +01:00
|
|
|
redirect_to login_path
|
2011-03-27 22:56:15 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|