Class: Spud::SetupController

Inherits:
ApplicationController show all
Defined in:
app/controllers/spud/setup_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/spud/setup_controller.rb', line 3

def index
	@page_thumbnail = "spud/admin/users_thumb.png"
	@page_name = "First Time Setup"
	if SpudUser.count != 0
			flash[:error] = "Access Denied! This wizard may only be executed when the database is empty."
			redirect_to root_url() and return
	end

	if request.post?
		@user = SpudUser.new(:login => params[:login],:email => params[:email],:password => params[:password],:password_confirmation => params[:password_confirmation])
		@user.super_admin = true
		if @user.save
			redirect_to spud_admin_root_url() and return
		end
		
		flash[:error] = "Error creating administrative account!"
	else
	end
end