Fixed issue causing account verify to throw 404 (#1987)

This commit is contained in:
Ahmad Farhat
2020-08-04 14:04:47 -04:00
committed by GitHub
parent 0710c569b7
commit 620416f18a
5 changed files with 11 additions and 5 deletions

View File

@ -20,7 +20,8 @@ class AccountActivationsController < ApplicationController
include Emailer
before_action :ensure_unauthenticated
before_action :find_user
before_action :find_user, except: :show
before_action :find_user_by_digest, only: :show
# GET /account_activations
def show
@ -63,6 +64,10 @@ class AccountActivationsController < ApplicationController
@user = User.find_by!(activation_digest: User.hash_token(params[:token]), provider: @user_domain)
end
def find_user_by_digest
@user = User.find_by!(activation_digest: params[:digest], provider: @user_domain)
end
def ensure_unauthenticated
redirect_to current_user.main_room if current_user
end

View File

@ -371,7 +371,7 @@ class RoomsController < ApplicationController
end
def validate_verified_email
redirect_to account_activation_path(current_user) if current_user && !current_user&.activated?
redirect_to account_activation_path(digest: current_user.activation_digest) if current_user && !current_user&.activated?
end
def verify_room_owner_verified

View File

@ -88,7 +88,7 @@ class SessionsController < ApplicationController
# Check that the user is a Greenlight account
return redirect_to(root_path, alert: I18n.t("invalid_login_method")) unless user.greenlight_account?
# Check that the user has verified their account
return redirect_to(account_activation_path(token: user.create_activation_token)) unless user.activated?
return redirect_to(account_activation_path(digest: user.activation_digest)) unless user.activated?
end
login(user)