Skip to content

Commit

Permalink
Merge pull request #680 from leancloud/feat/require-phone
Browse files Browse the repository at this point in the history
feat: require mobilePhoneNumber
  • Loading branch information
juvenn committed Jul 4, 2024
2 parents b88f4ea + a93320e commit e4241f9
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 19 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ jobs:
node-version: 16
- run: npm ci
- run: npm test
env:
SERVER_URL: https://qvnm6ag2.api.lncldglobal.com
APPID: QvNM6AG2khJtBQo6WRMWqfLV-gzGzoHsz
APPKEY: be2YmUduiuEnCB2VR9bLRnnV
MASTERKEY: ${{ secrets.MASTER_KEY }}
HOOKKEY: ${{ secrets.HOOK_KEY }}
- uses: codecov/codecov-action@v3
- run: npm run build
- if: github.ref_name == 'master'
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 4.15.3 (2024-07-01)

### Bug Fixes

- `resetPasswordBySmsCode``verifyMobilePhone` 支持传递 mobilePhoneNumber 参数。

## 4.15.2 (2023-10-11)

### Internal Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "leancloud-storage",
"version": "4.15.2",
"version": "4.15.3",
"main": "./dist/node/entry/index.js",
"description": "LeanCloud JavaScript SDK.",
"repository": {
Expand Down
11 changes: 7 additions & 4 deletions src/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -1731,11 +1731,12 @@ module.exports = function(AV) {
* The sms code is sent by AV.User.requestPasswordResetBySmsCode.
* @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
* @param {String} password The new password.
* @param {String} mobilePhoneNumber
* @return {Promise} A promise that will be resolved with the result
* of the function.
*/
resetPasswordBySmsCode: function(code, password) {
var json = { password: password };
resetPasswordBySmsCode: function(code, password, mobilePhoneNumber) {
var json = { password: password, mobilePhoneNumber: mobilePhoneNumber };
var request = AVRequest(
'resetPasswordBySmsCode',
null,
Expand All @@ -1750,11 +1751,13 @@ module.exports = function(AV) {
* Makes a call to verify sms code that sent by AV.User.Cloud.requestSmsCode
* If verify successfully,the user mobilePhoneVerified attribute will be true.
* @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
* @param {String} mobilePhoneNumber
* @return {Promise} A promise that will be resolved with the result
* of the function.
*/
verifyMobilePhone: function(code) {
var request = AVRequest('verifyMobilePhone', null, code, 'POST', null);
verifyMobilePhone: function(code, mobilePhoneNumber) {
var json = { mobilePhoneNumber: mobilePhoneNumber };
var request = AVRequest('verifyMobilePhone', null, code, 'POST', json);
return request;
},

Expand Down
2 changes: 1 addition & 1 deletion src/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = '4.15.2';
module.exports = '4.15.3';
7 changes: 6 additions & 1 deletion storage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,14 @@ export class User extends Object {
static resetPasswordBySmsCode(
code: string,
password: string,
mobilePhoneNumber: string,
options?: AuthOptions
): Promise<User>;
static verifyMobilePhone(
code: string,
mobilePhoneNumber: string,
options?: AuthOptions
): Promise<User>;
static verifyMobilePhone(code: string, options?: AuthOptions): Promise<User>;
static requestChangePhoneNumber(
mobilePhoneNumber: string,
ttl?: number,
Expand Down
17 changes: 5 additions & 12 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,11 @@ if (typeof require !== 'undefined') {
global.AV = require('../src/entry');
}

// AV.init({
// appId: 'Vpe1RqHgS5VGWBlhB6pdiiow-null',
// appKey: 'OxKVgM0izOIckMi9WiT0pBSf',
// masterKey: 'RCLNNJ6l51YJXzv7YG4fHA5v',
// serverURLs: 'https://cn-stg1.leancloud.cn',
// });

AV.init({
appId: process.env.APPID || '95TNUaOSUd8IpKNW0RSqSEOm-9Nh9j0Va',
appKey: process.env.APPKEY || 'gNAE1iHowdQvV7cqpfCMGaGN',
masterKey: process.env.MASTERKEY || 'ue9M9nqwD4MQNXD3oiN5rAOv',
hookKey: process.env.HOOKKEY || '2iCbUZDgEF0siKxmCn2kVQXV',
serverURLs: process.env.SERVER_URL || 'https://95tnuaos.lc-cn-e1-shared.com',
appId: process.env.APPID,
appKey: process.env.APPKEY,
masterKey: process.env.MASTERKEY,
hookKey: process.env.HOOKKEY,
serverURLs: process.env.SERVER_URL,
});
AV.setProduction(true);

0 comments on commit e4241f9

Please sign in to comment.