Sha256: ab67df9181e8aeb4cdbe34e8354a34ea8f46f06d6c3105f5b8417e0982f6eddf

Contents?: true

Size: 1.06 KB

Versions: 16

Compression:

Stored size: 1.06 KB

Contents

class Contour::RegistrationsController < Devise::RegistrationsController
  prepend_before_filter :require_no_authentication, :only => [ :new ]
  
  def create
    if user_signed_in?
      params[:user][:password] = params[:user][:password_confirmation] = Digest::SHA1.hexdigest(Time.now.usec.to_s)[0..19]
      @user = User.new(params[:user])
      if @user.save
        [:pp_committee, :pp_committee_secretary, :steering_committee, :steering_committee_secretary, :system_admin, :status].each do |attribute|
          @user.update_attribute attribute, params[:user][attribute]
        end
        redirect_to(@user, :notice => 'User was successfully created.')
      else
        render :action => "/users/new"
      end
    else
      super
      session[:omniauth] = nil unless @user.new_record?
    end
  end
    
  private
  
  def build_resource(*args)
    super
    if session[:omniauth]
      @user.apply_omniauth(session[:omniauth])
      @user.valid?
    end
  end
  
  def after_inactive_sign_up_path_for(resource)
    new_session_path(resource) # root_path
  end
  
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
contour-0.9.2 app/controllers/contour/registrations_controller.rb
contour-0.9.1 app/controllers/contour/registrations_controller.rb
contour-0.9.0 app/controllers/contour/registrations_controller.rb
contour-0.8.4 app/controllers/contour/registrations_controller.rb
contour-0.8.3 app/controllers/contour/registrations_controller.rb
contour-0.8.2 app/controllers/contour/registrations_controller.rb
contour-0.8.1 app/controllers/contour/registrations_controller.rb
contour-0.8.0 app/controllers/contour/registrations_controller.rb
contour-0.7.2 app/controllers/contour/registrations_controller.rb
contour-0.7.1 app/controllers/contour/registrations_controller.rb
contour-0.7.0 app/controllers/contour/registrations_controller.rb
contour-0.6.1 app/controllers/contour/registrations_controller.rb
contour-0.6.0 app/controllers/contour/registrations_controller.rb
contour-0.5.7 app/controllers/contour/registrations_controller.rb
contour-0.5.6 app/controllers/contour/registrations_controller.rb
contour-0.5.5 app/controllers/contour/registrations_controller.rb