Permit use confirmation token only when user create a new account or change the email

This commit is contained in:
Iraline
2022-05-05 16:54:56 -03:00
parent 54ec44742b
commit 4fd6253a00

View File

@@ -49,11 +49,11 @@ class Users::ConfirmationsController < Devise::ConfirmationsController
elsif resource.errors.empty? elsif resource.errors.empty?
set_official_position if resource.has_official_email? set_official_position if resource.has_official_email?
if resource.confirmed_at if !resource.confirmed_at || resource.unconfirmed_email
message = :already_confirmed
else
resource.confirm # Last change: confirm happens here for people with passwords instead of af the top of the show action resource.confirm # Last change: confirm happens here for people with passwords instead of af the top of the show action
message = :confirmed message = :confirmed
else
message = :already_confirmed
end end
set_flash_message(:notice, message) if is_flashing_format? set_flash_message(:notice, message) if is_flashing_format?