Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edavis10/893492 to your computer and use it in GitHub Desktop.
Save edavis10/893492 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment