提交 077a347d 编写于 作者: B binaryify

手机登录增加验证码登录方式 #1328, #1075 #1227

上级 ced76896
# 更新日志 # 更新日志
### 4.0.20 | 2021.8.20
- 手机登录增加验证码登录方式 [#1328](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1328)
### 4.0.19 | 2021.8.10 ### 4.0.19 | 2021.8.10
- 修复若干问题 - 修复若干问题
......
...@@ -426,11 +426,13 @@ $ sudo docker run -d -p 3000:3000 netease-music-api ...@@ -426,11 +426,13 @@ $ sudo docker run -d -p 3000:3000 netease-music-api
**可选参数 :** **可选参数 :**
`countrycode`: 国家码,用于国外手机号登录,例如美国传入:`1` `countrycode`: 国家码,用于国外手机号登录,例如美国传入:`1`
`md5_password`: md5加密后的密码,传入后 `password` 将失效 `md5_password`: md5加密后的密码,传入后 `password` 参数将失效
`captcha`: 验证码,使用 [`/captcha/sent`](#发送验证码)接口传入手机号获取验证码,调用此接口传入验证码,可使用验证码登录,传入后 `password` 参数将失效
**接口地址 :** `/login/cellphone` **接口地址 :** `/login/cellphone`
**调用例子 :** `/login/cellphone?phone=xxx&password=yyy` `/login/cellphone?phone=xxx&md5_password=yyy` **调用例子 :** `/login/cellphone?phone=xxx&password=yyy` `/login/cellphone?phone=xxx&md5_password=yyy` `/login/cellphone?phone=xxx&captcha=1234`
#### 2. 邮箱登录 #### 2. 邮箱登录
......
...@@ -694,6 +694,14 @@ export function login_cellphone( ...@@ -694,6 +694,14 @@ export function login_cellphone(
} & RequestBaseConfig, } & RequestBaseConfig,
): Promise<Response> ): Promise<Response>
export function login_cellphone(
params: {
phone: number | string
countrycode?: number | string
captcha: number | string
} & RequestBaseConfig,
): Promise<Response>
export function login_refresh(params: RequestBaseConfig): Promise<Response> export function login_refresh(params: RequestBaseConfig): Promise<Response>
export function login_status(params: RequestBaseConfig): Promise<Response> export function login_status(params: RequestBaseConfig): Promise<Response>
......
...@@ -7,8 +7,10 @@ module.exports = async (query, request) => { ...@@ -7,8 +7,10 @@ module.exports = async (query, request) => {
const data = { const data = {
phone: query.phone, phone: query.phone,
countrycode: query.countrycode || '86', countrycode: query.countrycode || '86',
password: captcha: query.captcha,
query.md5_password || [query.captcha ? 'captcha' : 'password']: query.captcha
? query.captcha
: query.md5_password ||
crypto.createHash('md5').update(query.password).digest('hex'), crypto.createHash('md5').update(query.password).digest('hex'),
rememberLogin: 'true', rememberLogin: 'true',
} }
......
{ {
"name": "NeteaseCloudMusicApi", "name": "NeteaseCloudMusicApi",
"version": "4.0.19", "version": "4.0.20",
"description": "网易云音乐 NodeJS 版 API", "description": "网易云音乐 NodeJS 版 API",
"scripts": { "scripts": {
"start": "node app.js", "start": "node app.js",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册