npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@kne/fastify-account

v2.0.6

Published

用于用户注册登录认证.

Readme

fastify-account

描述

用于用户注册登录认证.

安装

npm i --save @kne/fastify-account

概述

功能模块

  • 账号管理:提供用户注册、登录、密码修改、忘记密码等功能。
  • 用户信息管理:支持用户信息的获取和更新。
  • 验证码服务:支持邮箱和短信验证码的发送与验证。

技术栈

  • 后端框架:Fastify
  • 数据库:Sequelize(支持多种数据库)
  • 认证:JWT(JSON Web Token)
  • 密码加密:bcryptjs
  • 工具库:Lodash、Day.js

核心模块

  • models:定义数据模型(用户、账号、验证码等)。
  • services:业务逻辑层,处理核心功能。
  • controllers:API接口层,定义路由和请求处理。

项目特点

  • 模块化设计,易于扩展和维护。
  • 支持多租户功能。
  • 提供详细的错误处理和日志记录。

示例

示例代码

API

账号管理

| 路径 | 方法 | 描述 | 参数 | |------|------|------|------| | /api/account/v1.0.0/account/sendEmailCode | POST | 发送登录邮箱验证码 | email (string), type (number), options (object) | | /api/account/v1.0.0/account/sendSMSCode | POST | 发送登录短信验证码 | phone (string), type (number), options (object) | | /api/account/v1.0.0/account/validateCode | POST | 验证码验证 | name (string), type (number), code (string) | | /api/account/v1.0.0/account/accountIsExists | POST | 账号是否已存在 | phone (string) 或 email (string) | | /api/account/v1.0.0/account/register | POST | 注册账号 | phone (string) 或 email (string), password (string), code (string), 其他可选字段 | | /api/account/v1.0.0/account/login | POST | 登录 | type (string), email (string) 或 phone (string), password (string) | | /api/account/v1.0.0/account/modifyPassword | POST | 修改密码 | email (string) 或 phone (string), newPwd (string), oldPwd (string) | | /api/account/v1.0.0/account/resetPassword | POST | 重置密码 | newPwd (string), token (string) | | /api/account/v1.0.0/account/forgetPwd | POST | 忘记密码 | email (string) 或 phone (string) | | /api/account/v1.0.0/account/parseResetToken | POST | 通过token获取name | token (string) |

用户信息管理

| 路径 | 方法 | 描述 | 参数 | |------|------|------|------| | /api/account/v1.0.0/user/getUserInfo | GET | 获取用户信息 | 无 | | /api/account/v1.0.0/user/saveUserInfo | POST | 更新用户信息 | avatar (string), nickname (string), email (string), phone (string), gender (string), birthday (string), description (string) |