Sha256: 15f9f1ca0a50583c2861b010b83edc3de934eca3dd193d3e7238c2191676fbdf

Contents?: true

Size: 1.55 KB

Versions: 89

Compression:

Stored size: 1.55 KB

Contents

class UserNotify < ActionMailer::Base
  def signup(user, password, url=nil)
    setup_email(user)

    # Email header info
    @subject += "Welcome to #{UserSystem::CONFIG[:app_name]}!"

    # Email body substitutions
    @body["name"] = "#{user.first_name} #{user.last_name}"
    @body["login"] = user.login
    @body["password"] = password
    @body["url"] = url || UserSystem::CONFIG[:app_url].to_s
    @body["app_name"] = UserSystem::CONFIG[:app_name].to_s
  end

  def forgot_password(user, url=nil)
    setup_email(user)

    # Email header info
    @subject += "Forgotten password notification"

    # Email body substitutions
    @body["name"] = "#{user.first_name} #{user.last_name}"
    @body["login"] = user.login
    @body["url"] = url || UserSystem::CONFIG[:app_url].to_s
    @body["app_name"] = UserSystem::CONFIG[:app_name].to_s
  end

  def change_password(user, password, url=nil)
    setup_email(user)

    # Email header info
    @subject += "Changed password notification"

    # Email body substitutions
    @body["name"] = "#{user.first_name} #{user.last_name}"
    @body["login"] = user.login
    @body["password"] = password
    @body["url"] = url || UserSystem::CONFIG[:app_url].to_s
    @body["app_name"] = UserSystem::CONFIG[:app_name].to_s
  end

  def setup_email(user)
    @recipients = "#{user.email}"
    @from       = UserSystem::CONFIG[:email_from].to_s
    @subject    = "[#{UserSystem::CONFIG[:app_name]}] "
    @sent_on    = Time.now
    @headers['Content-Type'] = "text/plain; charset=#{UserSystem::CONFIG[:mail_charset]}; format=flowed"
  end
end

Version data entries

89 entries across 89 versions & 1 rubygems

Version Path
backlog-0.0.0 app/models/user_notify.rb
backlog-0.0.1 app/models/user_notify.rb
backlog-0.0.2 app/models/user_notify.rb
backlog-0.0.4 app/models/user_notify.rb
backlog-0.0.5 app/models/user_notify.rb
backlog-0.1.1 app/models/user_notify.rb
backlog-0.1.0 app/models/user_notify.rb
backlog-0.1.2 app/models/user_notify.rb
backlog-0.10.1 app/models/user_notify.rb
backlog-0.10.0 app/models/user_notify.rb
backlog-0.10.2 app/models/user_notify.rb
backlog-0.10.4 app/models/user_notify.rb
backlog-0.10.3 app/models/user_notify.rb
backlog-0.10.5 app/models/user_notify.rb
backlog-0.10.6 app/models/user_notify.rb
backlog-0.10.7 app/models/user_notify.rb
backlog-0.10.8 app/models/user_notify.rb
backlog-0.12.0 app/models/user_notify.rb
backlog-0.11.0 app/models/user_notify.rb
backlog-0.12.1 app/models/user_notify.rb