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

16 lines
451 B
Ruby
Raw Normal View History

2024-04-14 19:01:32 +00:00
class AccountVerificationsController < ApplicationController
2024-04-21 14:01:10 +00:00
skip_before_action :authenticate, only: [ :show ]
2024-04-14 19:01:32 +00:00
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")
2024-04-21 14:01:10 +00:00
redirect_to login_path
2024-04-14 19:01:32 +00:00
end
end