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

16 lines
451 B
Ruby

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