Use User#generate_password in MailHandler.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11457 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2013-02-23 16:57:45 +00:00
parent fac4a79d4c
commit e14caf8e33
3 changed files with 15 additions and 11 deletions
+1 -3
View File
@@ -429,10 +429,8 @@ class MailHandler < ActionMailer::Base
assign_string_attribute_with_limit(user, 'firstname', names.shift, 30)
assign_string_attribute_with_limit(user, 'lastname', names.join(' '), 30)
user.lastname = '-' if user.lastname.blank?
password_length = [Setting.password_min_length.to_i, 10].max
user.password = Redmine::Utils.random_hex(password_length / 2 + 1)
user.language = Setting.default_language
user.generate_password = true
unless user.valid?
user.login = "user#{Redmine::Utils.random_hex(6)}" unless user.errors[:login].blank?