Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

township/township-reset-password-token

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

township-reset-password-token

Manage tokens for resetting passwords

npm travis standard conduct

About

A common part of using passwords for authentication includes resetting passwords and receiving an email with a special link that let's you reset the password.

This module takes care of generating and validating the tokens you use in the special links that get emailed out.

Install

npm install --save township-reset-password-token

Usage

var memdb = require('memdb')
var townshipResetPassword = require('township-reset-password-token')

var db = memdb()
var reset = townshipResetPassword(db, {
  secret: 'not a secret' // passed to jsonwebtoken
})

reset.create({ accountKey: 'key for an account' }, function (err, token) {
  if (err) return console.log(err)
  // typically would send the token as part of a link in an email

  // token would then be received by the server in an http request
  reset.confirm({ accountKey: 'key for an account', token: token }, function (err) {
    if (err) return console.log('token not confirmed', err)
    console.log('token confirmed')
  })
})

Documentation

Examples

Contributing

Contributions are welcome! Please read the contributing guidelines first.

Conduct

It's important that this project contributes to a friendly, safe, and welcoming environment for all, particularly for folks that are historically underrepresented in technology. Read this project's code of conduct

License

ISC

About

Manage tokens for resetting passwords

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published