• Download Gist
deliver_account_information_on_mail_handler_create.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index 12e7707..8326310 100644
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -339,8 +339,16 @@ class MailHandler < ActionMailer::Base
user.lastname = '-' if user.lastname.blank?
user.login = user.mail
- user.password = ActiveSupport::SecureRandom.hex(5)
+ password = ActiveSupport::SecureRandom.hex(5)
+ user.password = password
user.language = Setting.default_language
+ if user.save
+ Mailer.deliver_account_information(user, password)
+ return user
+ else
+ return nil
+ end
+
user.save ? user : nil
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.