Class: ReviseAuth::EmailController

Inherits:
ReviseAuthController show all
Defined in:
app/controllers/revise_auth/email_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject

GET /profile/email?confirmation_token=abcdef



5
6
7
8
9
10
11
12
# File 'app/controllers/revise_auth/email_controller.rb', line 5

def show
  if User.find_by_token_for(:email_verification, params[:confirmation_token])&.confirm_email_change
    flash[:notice] = t(".email_confirmed")
    redirect_to(user_signed_in? ? profile_path : root_path)
  else
    redirect_to root_path, alert: t(".email_confirm_failed")
  end
end

#updateObject



14
15
16
17
18
19
20
21
# File 'app/controllers/revise_auth/email_controller.rb', line 14

def update
  if current_user.update(email_params)
    current_user.send_confirmation_instructions
    flash[:notice] = t(".confirmation_email_sent", email: current_user.unconfirmed_email)
  end

  redirect_to profile_path
end