Sha256: 3cece12e33b4c52ce53f314b7f2f7e32434756cd7e8c814bd612fa01a09282e1

Contents?: true

Size: 1.24 KB

Versions: 24

Compression:

Stored size: 1.24 KB

Contents

class Contour::RegistrationsController < Devise::RegistrationsController
  prepend_before_filter :require_no_authentication, only: [ :new ]

  def create
    if signed_in?
      # TODO: Should use "Resource" and not "User"
      params[:user][:password] = params[:user][:password_confirmation] = Digest::SHA1.hexdigest(Time.now.usec.to_s)[0..19] if params[:user][:password].blank? and params[:user][:password_confirmation].blank?
      @user = User.new(params[:user])
      if @user.save
        respond_to do |format|
          format.html { redirect_to @user, notice: 'User was successfully created.' }
          format.json { render json: @user, only: [:id, :email], status: :created, location: @user }
        end
      else
        respond_to do |format|
          format.html { render action: "/users/new" }
          format.json { render json: @user.errors, status: :unprocessable_entity}
        end
      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

24 entries across 24 versions & 1 rubygems

Version Path
contour-1.1.0.rc2 app/controllers/contour/registrations_controller.rb
contour-1.1.0.rc app/controllers/contour/registrations_controller.rb
contour-1.0.5 app/controllers/contour/registrations_controller.rb
contour-1.1.0.pre2 app/controllers/contour/registrations_controller.rb
contour-1.1.0.pre app/controllers/contour/registrations_controller.rb
contour-1.0.4 app/controllers/contour/registrations_controller.rb
contour-1.0.3 app/controllers/contour/registrations_controller.rb
contour-1.0.2 app/controllers/contour/registrations_controller.rb
contour-1.0.1 app/controllers/contour/registrations_controller.rb
contour-1.0.0 app/controllers/contour/registrations_controller.rb
contour-1.0.0.rc2 app/controllers/contour/registrations_controller.rb
contour-1.0.0.rc app/controllers/contour/registrations_controller.rb
contour-1.0.0.beta12 app/controllers/contour/registrations_controller.rb
contour-1.0.0.beta11 app/controllers/contour/registrations_controller.rb
contour-1.0.0.beta10 app/controllers/contour/registrations_controller.rb
contour-1.0.0.beta9 app/controllers/contour/registrations_controller.rb
contour-1.0.0.beta8 app/controllers/contour/registrations_controller.rb
contour-1.0.0.beta7 app/controllers/contour/registrations_controller.rb
contour-1.0.0.beta6 app/controllers/contour/registrations_controller.rb
contour-1.0.0.beta5 app/controllers/contour/registrations_controller.rb