Class: Protege::EmailDomainsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/protege/email_domains_controller.rb

Overview

Manages email domains the engine receives mail for.

Creating a domain generates a DKIM keypair automatically. The show page surfaces all DNS records the operator must configure before the domain goes live.

Instance Method Summary collapse

Instance Method Details

#createvoid

This method returns an undefined value.

Create an email domain, generating its DKIM keypair on save. Serves POST /email_domains.

On success, redirect to the show page so the operator can read the DNS records; on failure, re-render the form with validation errors.



32
33
34
35
36
37
38
39
40
# File 'app/controllers/protege/email_domains_controller.rb', line 32

def create
  @email_domain = EmailDomain.new(email_domain_params)

  if @email_domain.save
    redirect_to email_domain_path(@email_domain), notice: 'Domain added. Configure the DNS records below.'
  else
    render :new, status: :unprocessable_entity
  end
end

#destroyvoid

This method returns an undefined value.

Delete an email domain. Serves DELETE /email_domains/:id.



50
51
52
53
54
# File 'app/controllers/protege/email_domains_controller.rb', line 50

def destroy
  @email_domain.destroy!

  redirect_to email_domains_path, notice: 'Domain removed.'
end

#indexvoid

This method returns an undefined value.

List every configured email domain, ordered by name. Serves GET /email_domains.



15
16
17
# File 'app/controllers/protege/email_domains_controller.rb', line 15

def index
  @email_domains = EmailDomain.order(:domain)
end

#newvoid

This method returns an undefined value.

Render the form for adding a new email domain. Serves GET /email_domains/new.



22
23
24
# File 'app/controllers/protege/email_domains_controller.rb', line 22

def new
  @email_domain = EmailDomain.new
end

#showvoid

This method returns an undefined value.

Show a single domain and the DNS records required to activate it. Serves GET /email_domains/:id.



45
# File 'app/controllers/protege/email_domains_controller.rb', line 45

def show; end