Sha256: fa423133390bd3c873abbdf943b06ee7abd2c9d2053d7d0fc5f8b6229f21a8e8

Contents?: true

Size: 770 Bytes

Versions: 21

Compression:

Stored size: 770 Bytes

Contents

require_dependency "mtwarden/application_controller"

module Mtwarden
	class AccountsController < ApplicationController
		def new
			@account = Mtwarden::Account.new
			@account.build_owner
		end

		def create
			@account = Mtwarden::Account.create_with_owner(account_params)
			if @account.valid?
				force_authentication!(@account.owner)
				flash[:success] = "Your account has been successfully created."
				redirect_to mtwarden.root_url(:subdomain => @account.subdomain)
			else
				flash[:error] = "Sorry, your account could not be created."
				render :new
			end
		end

		private

		def account_params
			params.require(:account).permit(:name, :subdomain, 
				{ :owner_attributes => [
					[:email, :password, :password_confirmation]
				]}
			)
		end
	end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
mtwarden-3.6.1 app/controllers/mtwarden/accounts_controller.rb
mtwarden-3.6.0 app/controllers/mtwarden/accounts_controller.rb
mtwarden-3.5.1 app/controllers/mtwarden/accounts_controller.rb
mtwarden-3.5.0 app/controllers/mtwarden/accounts_controller.rb
mtwarden-3.3.4 app/controllers/mtwarden/accounts_controller.rb
mtwarden-3.3.3 app/controllers/mtwarden/accounts_controller.rb
mtwarden-3.3.2 app/controllers/mtwarden/accounts_controller.rb
mtwarden-3.3.1 app/controllers/mtwarden/accounts_controller.rb
mtwarden-3.3.0 app/controllers/mtwarden/accounts_controller.rb
mtwarden-3.2.0 app/controllers/mtwarden/accounts_controller.rb
mtwarden-3.1.2 app/controllers/mtwarden/accounts_controller.rb
mtwarden-3.1.1 app/controllers/mtwarden/accounts_controller.rb
mtwarden-3.1.0 app/controllers/mtwarden/accounts_controller.rb
mtwarden-3.0.3 app/controllers/mtwarden/accounts_controller.rb
mtwarden-3.0.2 app/controllers/mtwarden/accounts_controller.rb
mtwarden-3.0.1 app/controllers/mtwarden/accounts_controller.rb
mtwarden-2.2.7 app/controllers/mtwarden/accounts_controller.rb
mtwarden-2.2.6 app/controllers/mtwarden/accounts_controller.rb
mtwarden-2.2.5 app/controllers/mtwarden/accounts_controller.rb
mtwarden-2.2.0 app/controllers/mtwarden/accounts_controller.rb