Sha256: 7ec3dfa620e40b97e7d8276da1674ebd46aeccca2aa9a83734668eca6802314f

Contents?: true

Size: 758 Bytes

Versions: 13

Compression:

Stored size: 758 Bytes

Contents

class Admin::SetupController < Admin::ApplicationController

  skip_before_action :require_user, :require_admin_user

  def new
    if SpudUser.count != 0
      flash[:error] = "Access Denied! This wizard may only be executed when the database is empty."
      redirect_to admin_login_path and return
    else
      @spud_user = SpudUser.new  
    end
  end

  def create
    @spud_user = SpudUser.new(user_params)
    @spud_user.super_admin = true
    if @spud_user.save
      SpudUserSession.create(@spud_user)
      redirect_to admin_root_path
    else
      render 'new', :status => 422
    end
  end

private

  def user_params
    params.require(:spud_user).permit(:login, :email, :password, :password_confirmation, :first_name, :last_name)
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
tb_core-1.3.10 app/controllers/admin/setup_controller.rb
tb_core-1.3.9 app/controllers/admin/setup_controller.rb
tb_core-1.3.7 app/controllers/admin/setup_controller.rb
tb_core-1.3.6 app/controllers/admin/setup_controller.rb
tb_core-1.3.5 app/controllers/admin/setup_controller.rb
tb_core-1.3.4 app/controllers/admin/setup_controller.rb
tb_core-1.3.3 app/controllers/admin/setup_controller.rb
tb_core-1.3.2 app/controllers/admin/setup_controller.rb
tb_core-1.3.1 app/controllers/admin/setup_controller.rb
tb_core-1.3.0 app/controllers/admin/setup_controller.rb
tb_core-1.3.0.beta2 app/controllers/admin/setup_controller.rb
tb_core-1.3.0.beta1 app/controllers/admin/setup_controller.rb
tb_core-1.2.8 app/controllers/admin/setup_controller.rb