Sha256: dd253be7210e2d53c2fc46e984a7e9c2ddacd17a2f2a30d7589ba205fd826c39

Contents?: true

Size: 694 Bytes

Versions: 10

Compression:

Stored size: 694 Bytes

Contents

class EmailVerificationsController < ApplicationController
  skip_before_action :authenticate, only: :edit

  before_action :set_<%= singular_table_name %>, only: :edit

  def edit
    @<%= singular_table_name %>.update! verified: true
  end

  def create
    IdentityMailer.with(<%= singular_table_name %>: Current.<%= singular_table_name %>).email_verify_confirmation.deliver_later
  end

  private
    def set_<%= singular_table_name %>
      @<%= singular_table_name %> = <%= class_name %>.where(email: params[:email]).find_signed!(params[:token], purpose: params[:email])
    rescue
      render json: { error: "That email verification link is invalid" }, status: :bad_request
    end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
authentication-zero-2.7.0 lib/generators/authentication/templates/controllers/api/email_verifications_controller.rb.tt
authentication-zero-2.6.0 lib/generators/authentication/templates/controllers/api/email_verifications_controller.rb.tt
authentication-zero-2.5.1 lib/generators/authentication/templates/controllers/api/email_verifications_controller.rb.tt
authentication-zero-2.5.0 lib/generators/authentication/templates/controllers/api/email_verifications_controller.rb.tt
authentication-zero-2.4.0 lib/generators/authentication/templates/controllers/api/email_verifications_controller.rb.tt
authentication-zero-2.3.6 lib/generators/authentication/templates/controllers/api/email_verifications_controller.rb.tt
authentication-zero-2.3.5 lib/generators/authentication/templates/controllers/api/email_verifications_controller.rb.tt
authentication-zero-2.3.4 lib/generators/authentication/templates/controllers/api/email_verifications_controller.rb.tt
authentication-zero-2.3.3 lib/generators/authentication/templates/controllers/api/email_verifications_controller.rb.tt
authentication-zero-2.3.2 lib/generators/authentication/templates/controllers/api/email_verifications_controller.rb.tt