FIX: rake admin:invite sends an email that makes it clear that an account was created for the recipient

This commit is contained in:
Neil Lalonde 2014-09-11 12:47:17 -04:00
parent 4a3e46ee4a
commit 0a9e284277
3 changed files with 14 additions and 2 deletions

View file

@ -30,6 +30,10 @@ class UserNotifications < ActionMailer::Base
email_token: opts[:email_token]) email_token: opts[:email_token])
end 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={}) def digest(user, opts={})
@user = user @user = user

View file

@ -1678,6 +1678,14 @@ en:
Click the following link to choose a password: Click the following link to choose a password:
%{base_url}/users/password-reset/%{email_token} %{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: authorize_email:
subject_template: "[%{site_name}] Confirm your new email address" subject_template: "[%{site_name}] Confirm your new email address"
text_body_template: | text_body_template: |

View file

@ -22,9 +22,9 @@ task "admin:invite", [:email] => [:environment] do |_,args|
user.change_trust_level!(4) user.change_trust_level!(4)
user.email_tokens.update_all confirmed: true user.email_tokens.update_all confirmed: true
puts "Sending forgot password emails!" puts "Sending email!"
email_token = user.email_tokens.create(email: user.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 end
desc "Creates a forum administrator" desc "Creates a forum administrator"