converted user signup mail

pull/1186/head
Martin Linkhorst 12 years ago
parent a585c1b437
commit c75db28327
  1. 23
      app/mailers/user_mailer.rb
  2. 2
      app/views/mailer/register.html.erb
  3. 2
      app/views/mailer/register.text.erb
  4. 2
      app/views/user_mailer/user_signed_up.html.erb
  5. 2
      app/views/user_mailer/user_signed_up.text.erb
  6. 11
      test/functional/user_mailer_test.rb

@ -108,7 +108,28 @@ class UserMailer < ActionMailer::Base
mail :to => to, :subject => subject
end
end
def user_signed_up(token)
@token = token
@activation_url = url_for(:controller => :account,
:action => :activate,
:token => @token.value)
headers["X-OpenProject-Type"] = "Account"
user = token.user
to = user.mail
locale = user.language.presence || I18n.default_locale
I18n.with_locale(locale) do
subject = t(:mail_subject_register, :value => Setting.app_title)
mail :to => to, :subject => subject
end
end
private
def assigned_to_header(user)

@ -1,2 +0,0 @@
<p><%= l(:mail_body_register) %><br />
<%= auto_link(@url) %></p>

@ -1,2 +0,0 @@
<%= l(:mail_body_register) %>
<%= @url %>

@ -0,0 +1,2 @@
<p><%= l(:mail_body_register) %><br />
<%= link_to @activation_url, @activation_url %></p>

@ -0,0 +1,2 @@
<%= t(:mail_body_register) %>
<%= @activation_url %>

@ -173,4 +173,15 @@ class UserMailerTest < ActionMailer::TestCase
assert ActionMailer::Base.deliveries.empty?
end
def test_user_signed_up
token = Token.find(1)
Setting.host_name = 'redmine.foo'
Setting.protocol = 'https'
ActionMailer::Base.deliveries.clear
assert UserMailer.user_signed_up(token).deliver
mail = ActionMailer::Base.deliveries.last
assert mail.body.include?("https://redmine.foo/account/activate?token=#{token.value}")
end
end

Loading…
Cancel
Save