Sha256: d3b6af42377908196cd7f5d24329069565f2e681dc9c2222c2f50bdee4bde01c

Contents?: true

Size: 948 Bytes

Versions: 13

Compression:

Stored size: 948 Bytes

Contents

class MyAdmin::FirstUsersController < MyAdmin::MyAdminController
  
  def new
    @user = MyAdmin::User.new
  end
  
  def create
    @user = MyAdmin::User.new(my_admin_user_params)
    @user.superuser = true

    if @user.save
      my_admin_sign_in @user
      flash[:notice] = I18n.t("my_admin.messages.user.created")
      redirect_to send("#{admin_prefix}_root_path")
    else
      render :new
    end
  end
  
protected

  def verify_login

  end

  def verify_first_access
    unless(MyAdmin::User.count == 0)
      flash[:notice] =  I18n.t("my_admin.messages.user.already_created")
      
      if my_admin_locked?
        redirect_to send("unlock_#{admin_prefix}_sessions_path")
      else
        redirect_to send("new_#{admin_prefix}_sessions_path")
      end
    end
  end
  
  def my_admin_user_params
    params.require(:my_admin_user).permit(:first_name, :last_name, :username, :password, :password_confirmation, :email)
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
my_admin-0.1.13 app/controllers/my_admin/first_users_controller.rb
my_admin-0.1.12 app/controllers/my_admin/first_users_controller.rb
my_admin-0.1.11 app/controllers/my_admin/first_users_controller.rb
my_admin-0.1.10 app/controllers/my_admin/first_users_controller.rb
my_admin-0.1.9 app/controllers/my_admin/first_users_controller.rb
my_admin-0.1.8 app/controllers/my_admin/first_users_controller.rb
my_admin-0.1.7 app/controllers/my_admin/first_users_controller.rb
my_admin-0.1.6 app/controllers/my_admin/first_users_controller.rb
my_admin-0.1.5 app/controllers/my_admin/first_users_controller.rb
my_admin-0.1.4 app/controllers/my_admin/first_users_controller.rb
my_admin-0.1.3 app/controllers/my_admin/first_users_controller.rb
my_admin-0.1.2 app/controllers/my_admin/first_users_controller.rb
my_admin-0.1.1 app/controllers/my_admin/first_users_controller.rb