Skip to content

Commit

Permalink
FIX: rake admin:invite sends an email that makes it clear that an acc…
Browse files Browse the repository at this point in the history
…ount was created for the recipient
  • Loading branch information
nlalonde committed Sep 11, 2014
1 parent 4a3e46e commit 0a9e284
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/mailers/user_notifications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ def forgot_password(user, opts={})
email_token: opts[:email_token])
end

def account_created(user, opts={})
build_email( user.email, template: "user_notifications.account_created", email_token: opts[:email_token])
end


def digest(user, opts={})
@user = user
Expand Down
8 changes: 8 additions & 0 deletions config/locales/server.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1678,6 +1678,14 @@ en:
Click the following link to choose a password:
%{base_url}/users/password-reset/%{email_token}
account_created:
subject_template: "[%{site_name}] Your New Account"
text_body_template: |
A new account was created for you at %{site_name}
Click the following link to choose a password for your new account:
%{base_url}/users/password-reset/%{email_token}
authorize_email:
subject_template: "[%{site_name}] Confirm your new email address"
text_body_template: |
Expand Down
4 changes: 2 additions & 2 deletions lib/tasks/admin.rake
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ task "admin:invite", [:email] => [:environment] do |_,args|
user.change_trust_level!(4)
user.email_tokens.update_all confirmed: true

puts "Sending forgot password emails!"
puts "Sending email!"
email_token = user.email_tokens.create(email: user.email)
Jobs.enqueue(:user_email, type: :forgot_password, user_id: user.id, email_token: email_token.token)
Jobs.enqueue(:user_email, type: :account_created, user_id: user.id, email_token: email_token.token)
end

desc "Creates a forum administrator"
Expand Down

0 comments on commit 0a9e284

Please sign in to comment.