Sha256: d29da25894f5c5b7fbd79f8b17e9bb04e519d21e6c56c53105796508e17f4880

Contents?: true

Size: 553 Bytes

Versions: 8

Compression:

Stored size: 553 Bytes

Contents

class Identity::EmailVerificationsController < ApplicationController
  skip_before_action :authenticate, only: :show

  before_action :set_user, only: :show

  def show
    @user.update!(verified: true); head(:no_content)
  end

  def create
    UserMailer.with(user: Current.user).email_verification.deliver_later
  end

  private
    def set_user
      @user = User.find_by_token_for!(:email_verification, params[:sid])
    rescue StandardError
      render json: { error: "That email verification link is invalid" }, status: :bad_request
    end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
authentication-zero-4.0.3 lib/generators/authentication/templates/controllers/api/identity/email_verifications_controller.rb.tt
authentication-zero-4.0.2 lib/generators/authentication/templates/controllers/api/identity/email_verifications_controller.rb.tt
authentication-zero-4.0.1 lib/generators/authentication/templates/controllers/api/identity/email_verifications_controller.rb.tt
authentication-zero-4.0.0 lib/generators/authentication/templates/controllers/api/identity/email_verifications_controller.rb.tt
authentication-zero-3.0.2 lib/generators/authentication/templates/controllers/api/identity/email_verifications_controller.rb.tt
authentication-zero-3.0.1 lib/generators/authentication/templates/controllers/api/identity/email_verifications_controller.rb.tt
authentication-zero-3.0.0 lib/generators/authentication/templates/controllers/api/identity/email_verifications_controller.rb.tt
authentication-zero-3.0.0.alpha1 lib/generators/authentication/templates/controllers/api/identity/email_verifications_controller.rb.tt