tabletop-companion/app/controllers/account_verifications_contr...

18 lines
482 B
Ruby

# frozen_string_literal: true
class AccountVerificationsController < ApplicationController
skip_before_action :authenticate, only: [ :show ]
def show
user = User.find_by_token_for(:email_verification, params[:id])
unless user
flash[:alert] = t(".error")
redirect_to :root and return
end
user.update(verified: true)
UserMailer.with(user: user).email_verified.deliver_later
flash[:notice] = t(".success")
redirect_to login_path
end
end