mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
UX: show user email address on "grant admin access" email and UI
This commit is contained in:
parent
f66e5d38d3
commit
b7327d2c34
|
@ -7,13 +7,15 @@ module Jobs
|
||||||
def execute(args)
|
def execute(args)
|
||||||
to_address = args[:to_address]
|
to_address = args[:to_address]
|
||||||
token = args[:token]
|
token = args[:token]
|
||||||
|
target_email = args[:target_email]
|
||||||
target_username = args[:target_username]
|
target_username = args[:target_username]
|
||||||
|
|
||||||
raise Discourse::InvalidParameters.new(:to_address) if to_address.blank?
|
raise Discourse::InvalidParameters.new(:to_address) if to_address.blank?
|
||||||
raise Discourse::InvalidParameters.new(:token) if token.blank?
|
raise Discourse::InvalidParameters.new(:token) if token.blank?
|
||||||
|
raise Discourse::InvalidParameters.new(:target_email) if target_email.blank?
|
||||||
raise Discourse::InvalidParameters.new(:target_username) if target_username.blank?
|
raise Discourse::InvalidParameters.new(:target_username) if target_username.blank?
|
||||||
|
|
||||||
message = AdminConfirmationMailer.send_email(to_address, target_username, token)
|
message = AdminConfirmationMailer.send_email(to_address, target_email, target_username, token)
|
||||||
Email::Sender.new(message, :admin_confirmation_message).send
|
Email::Sender.new(message, :admin_confirmation_message).send
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,11 @@
|
||||||
class AdminConfirmationMailer < ActionMailer::Base
|
class AdminConfirmationMailer < ActionMailer::Base
|
||||||
include Email::BuildEmailHelper
|
include Email::BuildEmailHelper
|
||||||
|
|
||||||
def send_email(to_address, target_username, token)
|
def send_email(to_address, target_email, target_username, token)
|
||||||
build_email(
|
build_email(
|
||||||
to_address,
|
to_address,
|
||||||
template: 'admin_confirmation_mailer',
|
template: 'admin_confirmation_mailer',
|
||||||
|
target_email: target_email,
|
||||||
target_username: target_username,
|
target_username: target_username,
|
||||||
admin_confirm_url: confirm_admin_url(token: token, host: Discourse.base_url)
|
admin_confirm_url: confirm_admin_url(token: token, host: Discourse.base_url)
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<%- unless @confirmed %>
|
<%- unless @confirmed %>
|
||||||
<%=raw (t('activation.admin_confirm.description', target_username: @confirmation.target_user.username)) %>
|
<%=raw (t('activation.admin_confirm.description', target_email: @confirmation.target_user.email, target_username: @confirmation.target_user.username)) %>
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|
|
@ -822,7 +822,7 @@ en:
|
||||||
activated: "Sorry, this account has already been activated."
|
activated: "Sorry, this account has already been activated."
|
||||||
admin_confirm:
|
admin_confirm:
|
||||||
title: "Confirm Admin Account"
|
title: "Confirm Admin Account"
|
||||||
description: "Are you sure you want <b>%{target_username}</b> to be an administrator?"
|
description: "Are you sure you want <b>%{target_username} (%{target_email})</b> to be an administrator?"
|
||||||
grant: "Grant Admin Access"
|
grant: "Grant Admin Access"
|
||||||
complete: "<b>%{target_username}</b> is now an administrator."
|
complete: "<b>%{target_username}</b> is now an administrator."
|
||||||
back_to: "Return to %{title}"
|
back_to: "Return to %{title}"
|
||||||
|
@ -2477,7 +2477,7 @@ en:
|
||||||
title: "Admin Confirmation"
|
title: "Admin Confirmation"
|
||||||
subject_template: "[%{email_prefix}] Confirm new Admin Account"
|
subject_template: "[%{email_prefix}] Confirm new Admin Account"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
Please confirm that you'd like to add **%{target_username}** as an administrator for your forum.
|
Please confirm that you'd like to add **%{target_username} (%{target_email})** as an administrator for your forum.
|
||||||
|
|
||||||
[Confirm Administrator Account](%{admin_confirm_url})
|
[Confirm Administrator Account](%{admin_confirm_url})
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ class AdminConfirmation
|
||||||
Jobs.enqueue(
|
Jobs.enqueue(
|
||||||
:admin_confirmation_email,
|
:admin_confirmation_email,
|
||||||
to_address: @performed_by.email,
|
to_address: @performed_by.email,
|
||||||
|
target_email: @target_user.email,
|
||||||
target_username: @target_user.username,
|
target_username: @target_user.username,
|
||||||
token: @token
|
token: @token
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user