Skip to content

Commit

Permalink
Fix: explicitly load resetTokenExpireTime in password reset (#109)
Browse files Browse the repository at this point in the history
* explicitly load `resetTokenExpireTime` in password reset

* add sensitive attributes when loading the user in password reset
  • Loading branch information
muhammedBkf authored Nov 26, 2024
1 parent 69554eb commit 709849d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions helpers/users_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ def token(len)
end

def reset_password(email, username, token)
user = LinkedData::Models::User.where(email: email, username: username).include(User.goo_attrs_to_load(includes_param)).first
user = LinkedData::Models::User.where(email: email, username: username).include(User.goo_attrs_to_load(includes_param) + [:resetToken, :passwordHash, :resetTokenExpireTime]).first

error 404, "User not found" unless user

user.bring(:resetToken)
user.bring(:passwordHash)
user.show_apikey = true
token_accepted = token.eql?(user.resetToken)
if token_accepted
Expand Down

0 comments on commit 709849d

Please sign in to comment.