OSDN Git Service

Account information can now be sent to the user when creating an account.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 27 May 2007 10:57:13 +0000 (10:57 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 27 May 2007 10:57:13 +0000 (10:57 +0000)
ActionMailer logger set to nil for production environment to disable email contents output in production.log

git-svn-id: http://redmine.rubyforge.org/svn/trunk@546 e93f8b46-1217-0410-a6f0-8f06a7374b81

17 files changed:
app/controllers/users_controller.rb
app/models/mailer.rb
app/views/mailer/account_information.rhtml [new file with mode: 0644]
app/views/mailer/account_information_fr.rhtml [new file with mode: 0644]
app/views/users/add.rhtml
config/environments/production.rb
lang/bg.yml
lang/de.yml
lang/en.yml
lang/es.yml
lang/fr.yml
lang/it.yml
lang/ja.yml
lang/nl.yml
lang/pt-br.yml
lang/pt.yml
lang/zh.yml

index 45cec2e..93b3a4d 100644 (file)
@@ -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
index 41b5a32..62d5c16 100644 (file)
 
 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 (file)
index 0000000..058d5fc
--- /dev/null
@@ -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 (file)
index 0000000..9210988
--- /dev/null
@@ -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 %>
index d4c6a15..636bdcb 100644 (file)
@@ -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 %>
index 4cd4e08..eeafd95 100644 (file)
@@ -17,4 +17,6 @@ config.action_controller.perform_caching             = true
 \r
 # Disable delivery errors if you bad email addresses should just be ignored
 config.action_mailer.raise_delivery_errors = false
-\r
+
+# No email in production log
+config.action_mailer.logger = nil\r
index 47ade63..47281f0 100644 (file)
@@ -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: Изпращане
index 3fc39da..5b23bc7 100644 (file)
@@ -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
index 9cc452d..c6cb1a7 100644 (file)
@@ -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
index 523754c..c46ec9c 100644 (file)
@@ -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
index 35812bc..7231c55 100644 (file)
@@ -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
index 77a1216..827dcfd 100644 (file)
@@ -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
index 357777d..d3fce4f 100644 (file)
@@ -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: 変更
index 8b706f0..5f713f4 100644 (file)
@@ -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
index f3a6caf..3171f89 100644 (file)
@@ -395,6 +395,7 @@ label_message_plural: Messages
 label_message_last: Last message\r
 label_message_new: New message\r
 label_reply_plural: Replies\r
+label_send_information: Send account information to the user\r
 \r
 button_login: Login\r
 button_submit: Enviar\r
index 231b969..b91cfa2 100644 (file)
@@ -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
index 8f05ec9..17aef65 100644 (file)
@@ -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: 提交