Sha256: 12478321d54b372706414fd1102fdf0d4268792d06d92330c041bde8996cfcd8

Contents?: true

Size: 727 Bytes

Versions: 1

Compression:

Stored size: 727 Bytes

Contents

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

  before_action :set_user, only: :edit

  def edit
    @user.update! verified: true
    redirect_to root_path, notice: "Thank you for verifying your email address"
  end

  def create
    UserMailer.with(user: Current.user).email_confirmation.deliver_later
    redirect_to root_path, notice: "We sent a verification email to your email address"
  end

  private
    def set_user
      @user = User.where(email: params[:email]).find_signed!(params[:token], purpose: "verify_#{params[:email]}")
    rescue
      redirect_to edit_identity_email_path, alert: "That email verification link is invalid"
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
authentication-zero-2.12.5 lib/generators/authentication/templates/controllers/html/identity/email_verifications_controller.rb.tt