Created
September 1, 2009 15:28
-
-
Save stas/179159 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/app/controllers/account_controller.rb | |
+++ b/app/controllers/account_controller.rb | |
@@ -178,9 +178,24 @@ class AccountController < ApplicationController | |
redirect_to(home_url) && return unless Setting.self_registration? | |
# Create on the fly | |
- user.login = registration['nickname'] unless registration['nickname'].nil? | |
- user.mail = registration['email'] unless registration['email'].nil? | |
- user.firstname, user.lastname = registration['fullname'].split(' ') unless registration['fullname'].nil? | |
+ if !registration['nickname'].nil? | |
+ user.login = registration['nickname'] | |
+ else | |
+ user.login = ActiveSupport::SecureRandom.hex(6) | |
+ end | |
+ | |
+ if !registration['email'].nil? | |
+ user.mail = registration['email'] | |
+ else | |
+ user.mail = "please_update_your_email_" + user.login + "@domain.com" | |
+ end | |
+ | |
+ if !registration['fullname'].nil? | |
+ user.firstname, user.lastname = registration['fullname'].split(' ') | |
+ else | |
+ user.firstname = user.login | |
+ user.lastname = "-" | |
+ end | |
user.random_password | |
user.status = User::STATUS_REGISTERED | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment