+ def create
+ if params[:user] and Acl.no_account_creation(request.remote_ip, params[:user][:email].split("@").last)
+ render :action => 'blocked'
+
+ else
+ session[:referer] = params[:referer]
+
+ @user = User.new(params[:user])
+ @user.status = "pending"
+
+ if @user.openid_url.present? && @user.pass_crypt.empty?
+ # We are creating an account with OpenID and no password
+ # was specified so create a random one
+ @user.pass_crypt = SecureRandom.base64(16)
+ @user.pass_crypt_confirmation = @user.pass_crypt
+ end
+
+ if @user.invalid?
+ # Something is wrong with a new user, so rerender the form
+ render :action => "new"
+ elsif @user.openid_url.present?
+ # Verify OpenID before moving on
+ session[:new_user] = @user
+ openid_verify(@user.openid_url, @user)
+ else
+ # Save the user record
+ session[:new_user] = @user
+ redirect_to :action => :terms
+ end
+ end
+ end
+