Add require_unconfirmed to the confirmations controller

This commit is contained in:
Fosco Marotto 2021-02-19 21:29:07 -05:00
parent f1a857a7b4
commit c01328c8a0
1 changed files with 5 additions and 0 deletions

View File

@ -4,8 +4,13 @@ class Auth::ConfirmationsController < Devise::ConfirmationsController
layout 'auth' layout 'auth'
before_action :set_body_classes before_action :set_body_classes
before_action :require_unconfirmed!
before_action :set_user, only: [:finish_signup] before_action :set_user, only: [:finish_signup]
def require_unconfirmed!
redirect_to edit_user_registration_path if user_signed_in? && current_user.confirmed? && current_user.unconfirmed_email.blank?
end
def finish_signup def finish_signup
return unless request.patch? && params[:user] return unless request.patch? && params[:user]