Sha256: 6e7cda47b20d080813d3f8e82173f94f97acb6ccfb778537fc8e295a5d8d80b3

Contents?: true

Size: 769 Bytes

Versions: 5

Compression:

Stored size: 769 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

5 entries across 5 versions & 1 rubygems

Version Path
mtwarden-4.1.2 app/controllers/mtwarden/accounts_controller.rb
mtwarden-4.1.1 app/controllers/mtwarden/accounts_controller.rb
mtwarden-4.1.0 app/controllers/mtwarden/accounts_controller.rb
mtwarden-4.0.0 app/controllers/mtwarden/accounts_controller.rb
mtwarden-3.6.2 app/controllers/mtwarden/accounts_controller.rb