2022-01-22 18:17:44 +01:00
|
|
|
class ConfirmationsController < ApplicationController
|
2022-01-26 18:43:30 +01:00
|
|
|
layout "anonymous"
|
2022-01-22 18:17:44 +01:00
|
|
|
|
|
|
|
def create
|
|
|
|
@user = User.find_by(email: params[:user][:email].downcase)
|
|
|
|
|
|
|
|
if @user.present? && @user.unconfirmed?
|
|
|
|
redirect_to root_path, notice: "Check your email for confirmation instructions."
|
|
|
|
else
|
|
|
|
redirect_to new_confirmation_path, alert: "We could not find a user with that email or that email has already been confirmed."
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
|
|
|
@user = User.find_signed(params[:confirmation_token], purpose: :confirm_email)
|
|
|
|
|
|
|
|
if @user.present?
|
|
|
|
@user.confirm!
|
|
|
|
redirect_to root_path, notice: "Your account has been confirmed."
|
|
|
|
else
|
|
|
|
redirect_to new_confirmation_path, alert: "Invalid token."
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def new
|
|
|
|
@user = User.new
|
|
|
|
end
|
2023-02-26 15:09:08 +01:00
|
|
|
end
|