forked from External/greenlight
GRN2-xx: Restructured email verification and password reset (#1444)
* Restructured email verification and password reset * Fixed issue with password reset Co-authored-by: Jesus Federico <jesus@123it.ca>
This commit is contained in:
@ -29,7 +29,7 @@ class AccountActivationsController < ApplicationController
|
||||
# GET /account_activations/edit
|
||||
def edit
|
||||
# If the user exists and is not verified and provided the correct token
|
||||
if @user && !@user.activated? && @user.authenticated?(:activation, params[:token])
|
||||
if @user && !@user.activated?
|
||||
# Verify user
|
||||
@user.activate
|
||||
|
||||
@ -51,8 +51,7 @@ class AccountActivationsController < ApplicationController
|
||||
flash[:alert] = I18n.t("verify.already_verified")
|
||||
else
|
||||
# Resend
|
||||
@user.create_activation_token
|
||||
send_activation_email(@user)
|
||||
send_activation_email(@user, @user.create_activation_token)
|
||||
end
|
||||
|
||||
redirect_to root_path
|
||||
@ -61,7 +60,7 @@ class AccountActivationsController < ApplicationController
|
||||
private
|
||||
|
||||
def find_user
|
||||
@user = User.find_by!(activation_digest: User.digest(params[:token]), provider: @user_domain)
|
||||
@user = User.find_by!(activation_digest: User.hash_token(params[:token]), provider: @user_domain)
|
||||
end
|
||||
|
||||
def ensure_unauthenticated
|
||||
|
Reference in New Issue
Block a user