Sha256: 89d8b3c9a1601d63b7344e46b48027ebe62ca90b340618d39e1316f3240dfe35

Contents?: true

Size: 835 Bytes

Versions: 4

Compression:

Stored size: 835 Bytes

Contents

class EmailVerificationsController < ApplicationController
  before_action :set_<%= singular_table_name %>, only: :edit

  def edit
    @<%= singular_table_name %>.update! verified: true
    redirect_to root_path, notice: "Thank you for verifying your email address"
  end

  def create
    IdentityMailer.with(<%= singular_table_name %>: Current.<%= singular_table_name %>).email_verify_confirmation.deliver_later
    redirect_to root_path, notice: "We sent a verification email to your email address"
  end

  private
    def set_<%= singular_table_name %>
      @<%= singular_table_name %> = <%= class_name %>.find_signed!(params[:token], purpose: "verify_#{params[:email]}")
    rescue ActiveSupport::MessageVerifier::InvalidSignature
      redirect_to edit_email_path, alert: "That email verification link is invalid"
    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
authentication-zero-2.2.4 lib/generators/authentication/templates/controllers/html/email_verifications_controller.rb.tt
authentication-zero-2.2.3 lib/generators/authentication/templates/controllers/html/email_verifications_controller.rb.tt
authentication-zero-2.2.2 lib/generators/authentication/templates/controllers/html/email_verifications_controller.rb.tt
authentication-zero-2.2.1 lib/generators/authentication/templates/controllers/html/email_verifications_controller.rb.tt