diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 45cec2e7a..93b3a4d25 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -61,6 +61,7 @@ class UsersController < ApplicationController @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) } @user.custom_values = @custom_values if @user.save + Mailer.deliver_account_information(@user, params[:password]) if params[:send_information] flash[:notice] = l(:notice_successful_create) redirect_to :action => 'list' end diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 41b5a3291..62d5c1635 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -17,6 +17,14 @@ class Mailer < ActionMailer::Base helper IssuesHelper + + def account_information(user, password) + set_language_if_valid user.language + recipients user.mail + from Setting.mail_from + subject l(:mail_subject_register) + body :user => user, :password => password + end def issue_add(issue) set_language_if_valid(Setting.default_language) diff --git a/app/views/mailer/account_information.rhtml b/app/views/mailer/account_information.rhtml new file mode 100644 index 000000000..058d5fc44 --- /dev/null +++ b/app/views/mailer/account_information.rhtml @@ -0,0 +1,9 @@ +<% if @user.auth_source %>You can use your "<%= @user.auth_source.name %>" account to log into Redmine. +<% else %>Your Redmine account information: +* Login: <%= @user.login %> +* Password: <%= @password %> +<% end %> +Log in: <%= url_for :only_path => false, :host => Setting.host_name, :controller => 'account', :action => 'login' %> +<% unless @user.auth_source %> +You can change your password here: <%= url_for :only_path => false, :host => Setting.host_name, :controller => 'my', :action => 'account' %> +<% end %> diff --git a/app/views/mailer/account_information_fr.rhtml b/app/views/mailer/account_information_fr.rhtml new file mode 100644 index 000000000..9210988f4 --- /dev/null +++ b/app/views/mailer/account_information_fr.rhtml @@ -0,0 +1,9 @@ +<% if @user.auth_source %>Vous pouvez utiliser votre compte "<%= @user.auth_source.name %>" pour vous connecter à Redmine. +<% else %>Paramètres de connexion de votre compte Redmine: +* Identifiant: <%= @user.login %> +* Mot de passe: <%= @password %> +<% end %> +Pour se connecter à l'application: <%= url_for :only_path => false, :host => Setting.host_name, :controller => 'account', :action => 'login' %> +<% unless @user.auth_source %> +Vous pouvez changer votre mot de passe à l'adresse: <%= url_for :only_path => false, :host => Setting.host_name, :controller => 'my', :action => 'account' %> +<% end %> diff --git a/app/views/users/add.rhtml b/app/views/users/add.rhtml index d4c6a15f4..636bdcbcd 100644 --- a/app/views/users/add.rhtml +++ b/app/views/users/add.rhtml @@ -3,4 +3,5 @@ <% labelled_tabular_form_for :user, @user, :url => { :action => "add" } do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_create) %> -<% end %> \ No newline at end of file +<%= check_box_tag 'send_information', 1, true %> <%= l(:label_send_information) %> +<% end %> diff --git a/config/environments/production.rb b/config/environments/production.rb index 4cd4e086b..eeafd959e 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -17,4 +17,6 @@ config.action_controller.perform_caching = true # Disable delivery errors if you bad email addresses should just be ignored config.action_mailer.raise_delivery_errors = false - + +# No email in production log +config.action_mailer.logger = nil diff --git a/lang/bg.yml b/lang/bg.yml index 47ade6312..47281f068 100644 --- a/lang/bg.yml +++ b/lang/bg.yml @@ -395,6 +395,7 @@ label_message_plural: Messages label_message_last: Last message label_message_new: New message label_reply_plural: Replies +label_send_information: Send account information to the user button_login: Вход button_submit: Изпращане diff --git a/lang/de.yml b/lang/de.yml index 3fc39dad5..5b23bc7d2 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -395,6 +395,7 @@ label_message_plural: Messages label_message_last: Last message label_message_new: New message label_reply_plural: Replies +label_send_information: Send account information to the user button_login: Einloggen button_submit: OK diff --git a/lang/en.yml b/lang/en.yml index 9cc452d8f..c6cb1a770 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -395,6 +395,7 @@ label_message_plural: Messages label_message_last: Last message label_message_new: New message label_reply_plural: Replies +label_send_information: Send account information to the user button_login: Login button_submit: Submit diff --git a/lang/es.yml b/lang/es.yml index 523754c3d..c46ec9c57 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -395,6 +395,7 @@ label_message_plural: Messages label_message_last: Last message label_message_new: New message label_reply_plural: Replies +label_send_information: Send account information to the user button_login: Conexión button_submit: Someter diff --git a/lang/fr.yml b/lang/fr.yml index 35812bc7f..7231c558b 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -395,6 +395,7 @@ label_message_plural: Messages label_message_last: Dernier message label_message_new: Nouveau message label_reply_plural: Réponses +label_send_information: Envoyer les informations à l'utilisateur button_login: Connexion button_submit: Soumettre diff --git a/lang/it.yml b/lang/it.yml index 77a12162a..827dcfd06 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -395,6 +395,7 @@ label_message_plural: Messages label_message_last: Last message label_message_new: New message label_reply_plural: Replies +label_send_information: Send account information to the user button_login: Login button_submit: Invia diff --git a/lang/ja.yml b/lang/ja.yml index 357777d3b..d3fce4f73 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -396,6 +396,7 @@ label_message_plural: Messages label_message_last: Last message label_message_new: New message label_reply_plural: Replies +label_send_information: Send account information to the user button_login: ログイン button_submit: 変更 diff --git a/lang/nl.yml b/lang/nl.yml index 8b706f013..5f713f415 100644 --- a/lang/nl.yml +++ b/lang/nl.yml @@ -395,6 +395,7 @@ label_message_plural: Berichten label_message_last: Laatste bericht label_message_new: Nieuw bericht label_reply_plural: Antwoorden +label_send_information: Send account information to the user button_login: Inloggen button_submit: Toevoegen diff --git a/lang/pt-br.yml b/lang/pt-br.yml index f3a6caf74..3171f8945 100644 --- a/lang/pt-br.yml +++ b/lang/pt-br.yml @@ -395,6 +395,7 @@ label_message_plural: Messages label_message_last: Last message label_message_new: New message label_reply_plural: Replies +label_send_information: Send account information to the user button_login: Login button_submit: Enviar diff --git a/lang/pt.yml b/lang/pt.yml index 231b96992..b91cfa2da 100644 --- a/lang/pt.yml +++ b/lang/pt.yml @@ -395,6 +395,7 @@ label_message_plural: Messages label_message_last: Last message label_message_new: New message label_reply_plural: Replies +label_send_information: Send account information to the user button_login: Login button_submit: Enviar diff --git a/lang/zh.yml b/lang/zh.yml index 8f05ec9e2..17aef65bd 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -398,6 +398,7 @@ label_message_plural: Messages label_message_last: Last message label_message_new: New message label_reply_plural: Replies +label_send_information: Send account information to the user button_login: 登录 button_submit: 提交