Skip to content

Commit

Permalink
fix mailer
Browse files Browse the repository at this point in the history
  • Loading branch information
jkraemer committed Mar 8, 2010
1 parent f510422 commit 329cee5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/controllers/clearance/passwords_controller.rb
Expand Up @@ -13,7 +13,7 @@ def new
def create
if user = ::User.find_by_email(params[:password][:email])
user.forgot_password!
::ClearanceMailer.deliver_change_password user
::ClearanceMailer.change_password(user).deliver
flash_notice_after_create
redirect_to(url_after_create)
else
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/clearance/sessions_controller.rb
Expand Up @@ -21,7 +21,7 @@ def create
flash_success_after_create
redirect_back_or(url_after_create)
else
::ClearanceMailer.deliver_confirmation(@user)
::ClearanceMailer.confirmation(user).deliver
flash_notice_after_create
redirect_to(sign_in_url)
end
Expand Down
23 changes: 10 additions & 13 deletions app/mailers/clearance_mailer.rb
@@ -1,21 +1,18 @@
class ClearanceMailer < ActionMailer::Base

self.default :from => Clearance.configuration.mailer_sender

def change_password(user)
from Clearance.configuration.mailer_sender
recipients user.email
subject I18n.t(:change_password,
:scope => [:clearance, :models, :clearance_mailer],
:default => "Change your password")
body :user => user
@user = user
mail :to => user.email, :subject => I18n.t(:change_password,
:scope => [:clearance, :models, :clearance_mailer],
:default => "Change your password")
end

def confirmation(user)
from Clearance.configuration.mailer_sender
recipients user.email
subject I18n.t(:confirmation,
:scope => [:clearance, :models, :clearance_mailer],
:default => "Account confirmation")
body :user => user
@user = user
mail :to => user.email, :subject => I18n.t(:confirmation,
:scope => [:clearance, :models, :clearance_mailer],
:default => "Account confirmation")
end

end
2 changes: 1 addition & 1 deletion lib/clearance/user.rb
Expand Up @@ -190,7 +190,7 @@ def password_required?
end

def send_confirmation_email
ClearanceMailer.deliver_confirmation self
ClearanceMailer.confirmation(self).deliver
end
end

Expand Down

0 comments on commit 329cee5

Please sign in to comment.