GRN-94: Make sure reset-password also works on non-verified accounts (#448)

* Fix for issue with excesive requests to lb

* Fixed issue with rspec on users not passing when run alone

* Include dotenv in production

* GRN-94: Make sure reset-password also works on non-verified accounts
This commit is contained in:
Jesus Federico 2019-04-10 10:56:01 -04:00 committed by GitHub
parent 2b0301da38
commit 3dea09ee9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -84,7 +84,8 @@ class PasswordResetsController < ApplicationController
# Confirms a valid user.
def valid_user
unless current_user&.activated? && current_user.authenticated?(:reset, params[:id])
unless current_user.authenticated?(:reset, params[:id])
current_user&.activate unless current_user&.activated?
redirect_to root_url
end
end

View File

@ -127,6 +127,7 @@ class User < ApplicationRecord
def activate
update_attribute(:email_verified, true)
update_attribute(:activated_at, Time.zone.now)
save
end
def activated?