accounts-js / accounts

Fullstack authentication and accounts-management for Javascript.
https://www.accountsjs.com/
MIT License
1.5k stars 141 forks source link

feat(mongo)!: ttl for reset password tokens #1081

Open pradel opened 3 years ago

pradel commented 3 years ago

BREAKING CHANGE: Upgrading to this version will invalidate all the existing reset password tokens.

Once you updated the dependency in your project and deployed your server, to cleanup the database and remove the old reset password tokens run:

db.collection('users').updateMany({}, { $unset: { 'services.password.reset': '' } });

Related to #935

pradel commented 3 years ago

I am not really happy with this approach, would be better if the password module sends the expiration date for the token, will try with another approach.

Edit: solved

codecov[bot] commented 3 years ago

Codecov Report

Merging #1081 (f6937a6) into master (35c4c8c) will decrease coverage by 0.02%. The diff coverage is 95.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1081      +/-   ##
==========================================
- Coverage   95.53%   95.50%   -0.03%     
==========================================
  Files          93       93              
  Lines        2150     2159       +9     
  Branches      424      426       +2     
==========================================
+ Hits         2054     2062       +8     
- Misses         94       95       +1     
  Partials        2        2              
Impacted Files Coverage Δ
...ages/database-mongo-password/src/mongo-password.ts 98.97% <94.11%> (-1.03%) :arrow_down:
packages/database-mongo/src/mongo.ts 98.71% <100.00%> (ø)
packages/password/src/accounts-password.ts 91.46% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 35c4c8c...f6937a6. Read the comment docs.