Sha256: e735fde53ba47b5c3bab55f5ce490e06100e60ff228267af9cc21b4f20c503c9

Contents?: true

Size: 923 Bytes

Versions: 3

Compression:

Stored size: 923 Bytes

Contents

class Spud::SetupController < Spud::ApplicationController
	layout 'spud/setup'
	def index
		logger.debug("---Spud setup form running!")
		@page_thumbnail = "spud/admin/users_thumb.png"
		@page_name = "First Time Setup"
		if SpudUser.all.count != 0
				flash[:error] = "Access Denied! This wizard may only be executed when the database is empty."
				logger.debug "We have a user count: " + SpudUser.all.count.to_s
				
				redirect_to new_spud_user_session_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
				logger.debug "REDIRECTING!"
				session[:return_to] = spud_admin_root_url
				redirect_to new_spud_user_session_url and return
			end
			
			flash[:error] = "Error creating administrative account!"
		end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spud_core-0.8.13 app/controllers/spud/setup_controller.rb
spud_core-0.8.12 app/controllers/spud/setup_controller.rb
spud_core-0.8.11 app/controllers/spud/setup_controller.rb