diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index ce48649..e96cefd 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -15,10 +15,12 @@ class UserMailer < ActionMailer::Base end def activation_code(user) - @recipient = user.name, + @recipient = user.name @activation_code = user.activation_code @environment = user.environment.name @url = user.environment.top_url + @redirection = (true if user.return_to) + @join = (user.community_to_join if user.community_to_join) mail( from: "#{user.environment.name} <#{user.environment.contact_email}>", diff --git a/app/models/user.rb b/app/models/user.rb index 69be0c0..57033e1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -66,45 +66,6 @@ class User < ActiveRecord::Base # virtual attribute used to stash which community to join on signup or login attr_accessor :community_to_join - class Mailer < ActionMailer::Base - def activation_email_notify(user) - user_email = "#{user.login}@#{user.email_domain}" - recipients user_email - from "#{user.environment.name} <#{user.environment.noreply_email}>" - subject _("[%{environment}] Welcome to %{environment} mail!") % { :environment => user.environment.name } - body :name => user.name, - :email => user_email, - :webmail => MailConf.webmail_url(user.login, user.email_domain), - :environment => user.environment.name, - :url => url_for(:host => user.environment.default_hostname, :controller => 'home') - end - - def activation_code(user) - recipients user.email - - from "#{user.environment.name} <#{user.environment.noreply_email}>" - subject _("[%s] Activate your account") % [user.environment.name] - body :recipient => user.name, - :activation_code => user.activation_code, - :environment => user.environment.name, - :url => user.environment.top_url, - :redirection => (true if user.return_to), - :join => (user.community_to_join if user.community_to_join) - end - - def signup_welcome_email(user) - email_body = user.environment.signup_welcome_text_body.gsub('{user_name}', user.name) - email_subject = user.environment.signup_welcome_text_subject - - content_type 'text/html' - recipients user.email - - from "#{user.environment.name} <#{user.environment.noreply_email}>" - subject email_subject.blank? ? _("Welcome to environment %s") % [user.environment.name] : email_subject - body email_body - end - end - def signup! User.transaction do self.save! diff --git a/app/views/user/mailer/activation_email_notify.html.erb b/app/views/user/mailer/activation_email_notify.html.erb deleted file mode 100644 index 07a60aa..0000000 --- a/app/views/user/mailer/activation_email_notify.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<%= _('Hello %s,') % @name %> - -<%= _('Your email %s was just activated.') % [@email] %> - -<%= _('You can access your e-mail from anywhere, using the following address:') %> -<%= @webmail %> - -<%= _('Greetings,') %> - --- -<%= _('%s team.') % @environment %> -<%= @url %> diff --git a/app/views/user/mailer/signup_welcome_email.html.erb b/app/views/user/mailer/signup_welcome_email.html.erb deleted file mode 100644 index 6982a56..0000000 --- a/app/views/user/mailer/signup_welcome_email.html.erb +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - -

<%= word_wrap @body %>

- - diff --git a/app/views/user_mailer/activation_code.html.erb b/app/views/user_mailer/activation_code.html.erb new file mode 100644 index 0000000..efe9df7 --- /dev/null +++ b/app/views/user_mailer/activation_code.html.erb @@ -0,0 +1,9 @@ +<%= _('Hi, %{recipient}!') % { :recipient => @recipient } %> + +<%= word_wrap(_('Welcome to %{environment}! To activate your account, follow the link: %{activation_url}') % { :environment => @environment, :activation_url => @url + url_for(:controller => :account, :action => :activate, :activation_code => @activation_code, :redirection => @redirection, :join => @join) }) %> + +<%= _("Greetings,") %> + +-- +<%= _('%s team.') % @environment %> +<%= url_for @url %> diff --git a/app/views/user_mailer/activation_email_notify.html.erb b/app/views/user_mailer/activation_email_notify.html.erb new file mode 100644 index 0000000..07a60aa --- /dev/null +++ b/app/views/user_mailer/activation_email_notify.html.erb @@ -0,0 +1,12 @@ +<%= _('Hello %s,') % @name %> + +<%= _('Your email %s was just activated.') % [@email] %> + +<%= _('You can access your e-mail from anywhere, using the following address:') %> +<%= @webmail %> + +<%= _('Greetings,') %> + +-- +<%= _('%s team.') % @environment %> +<%= @url %> diff --git a/app/views/user_mailer/signup_welcome_email.html.erb b/app/views/user_mailer/signup_welcome_email.html.erb new file mode 100644 index 0000000..6982a56 --- /dev/null +++ b/app/views/user_mailer/signup_welcome_email.html.erb @@ -0,0 +1,9 @@ + + + + + + +

<%= word_wrap @body %>

+ + -- libgit2 0.21.2