Sha256: a0b06feb5596cbea8097c0c812194947d97eb2d4c183de0da3e4053506faeabc

Contents?: true

Size: 663 Bytes

Versions: 5

Compression:

Stored size: 663 Bytes

Contents

module Boxroom
  class AdminsController < Boxroom::ApplicationController
    include Boxroom::BaseController

    skip_before_action :require_admin_in_system, :require_login
    before_action :require_no_admin

    def new
      @user = User.new
    end

    def create
      @user = User.new(permitted_params.user)
      @user.password_required = true
      @user.is_admin = true

      if @user.save
        redirect_to new_session_url, :notice => t(:admin_user_created_successfully)
      else
        render :action => 'new'
      end
    end

    private

    def require_no_admin
      redirect_to new_session_url unless User.no_admin_yet?
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
boxroom-0.0.5 app/controllers/boxroom/admins_controller.rb
boxroom-0.0.4 app/controllers/boxroom/admins_controller.rb
boxroom-0.0.3 app/controllers/boxroom/admins_controller.rb
boxroom-0.0.2 app/controllers/boxroom/admins_controller.rb
boxroom-0.0.1 app/controllers/boxroom/admins_controller.rb