@cloudbase/auth 3.1.5 → 3.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +22 -9
- package/dist/cjs/type.d.ts +3 -0
- package/dist/cjs/type.js +1 -1
- package/dist/esm/index.js +22 -9
- package/dist/esm/type.d.ts +3 -0
- package/dist/esm/type.js +1 -1
- package/dist/miniprogram/index.js +1 -1
- package/package.json +5 -5
- package/src/index.ts +11 -0
- package/src/type.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/auth",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.7",
|
|
4
4
|
"description": "cloudbase javascript sdk auth componets",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"license": "Apache-2.0",
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@cloudbase/adapter-wx_mp": "^1.3.1",
|
|
35
|
-
"@cloudbase/oauth": "3.1.
|
|
36
|
-
"@cloudbase/utilities": "3.1.
|
|
35
|
+
"@cloudbase/oauth": "3.1.7",
|
|
36
|
+
"@cloudbase/utilities": "3.1.7"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@cloudbase/types": "3.1.
|
|
39
|
+
"@cloudbase/types": "3.1.7",
|
|
40
40
|
"@types/node": "^22.1.0",
|
|
41
41
|
"terser-webpack-plugin": "^3.0.2",
|
|
42
42
|
"webpack-bundle-analyzer": "^4.9.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "b36ee0d9385edeaadfbe64b726ac88d9087e8039"
|
|
45
45
|
}
|
package/src/index.ts
CHANGED
|
@@ -477,6 +477,9 @@ class Auth {
|
|
|
477
477
|
params: authModels.GetVerificationRequest,
|
|
478
478
|
options?: { withCaptcha: boolean },
|
|
479
479
|
): Promise<authModels.GetVerificationResponse> {
|
|
480
|
+
if (params.phone_number) {
|
|
481
|
+
params.phone_number = this.formatPhone(params.phone_number)
|
|
482
|
+
}
|
|
480
483
|
return this.oauthInstance.authApi.getVerification(params, options)
|
|
481
484
|
}
|
|
482
485
|
|
|
@@ -1351,6 +1354,7 @@ class Auth {
|
|
|
1351
1354
|
*/
|
|
1352
1355
|
async signUp(params: authModels.SignUpRequest & { phone?: string }): Promise<SignUpRes> {
|
|
1353
1356
|
if (params.phone_number || params.verification_code || params.verification_token || params.provider_token) {
|
|
1357
|
+
params.phone_number = this.formatPhone(params.phone_number)
|
|
1354
1358
|
await this.oauthInstance.authApi.signUp(params)
|
|
1355
1359
|
return this.createLoginState() as any
|
|
1356
1360
|
}
|
|
@@ -1535,6 +1539,13 @@ class Auth {
|
|
|
1535
1539
|
* @returns Promise<SignInWithOtpRes>
|
|
1536
1540
|
*/
|
|
1537
1541
|
async signInWithOtp(params: SignInWithOtpReq): Promise<SignInWithOtpRes> {
|
|
1542
|
+
if (params.options?.shouldCreateUser === undefined || !!params.options?.shouldCreateUser) {
|
|
1543
|
+
return this.signUp({
|
|
1544
|
+
email: params.email,
|
|
1545
|
+
phone: params.phone,
|
|
1546
|
+
})
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1538
1549
|
try {
|
|
1539
1550
|
// 参数校验:email或phone必填其一
|
|
1540
1551
|
this.validateAtLeastOne(params, [['email'], ['phone']], 'You must provide either an email or phone number')
|
package/src/type.ts
CHANGED