@cloudbase/auth 2.24.0 → 2.24.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/auth",
3
- "version": "2.24.0",
3
+ "version": "2.24.2",
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.2.1",
35
- "@cloudbase/oauth": "2.24.0",
36
- "@cloudbase/utilities": "2.24.0"
35
+ "@cloudbase/oauth": "2.24.2",
36
+ "@cloudbase/utilities": "2.24.2"
37
37
  },
38
38
  "devDependencies": {
39
- "@cloudbase/types": "2.24.0",
39
+ "@cloudbase/types": "2.24.2",
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": "7dac230344ecae3eec15358b2f85d782fde51839"
44
+ "gitHead": "7f79aaf12638c890668930555aff1de2434fcdc0"
45
45
  }
package/src/index.ts CHANGED
@@ -150,7 +150,7 @@ export class User implements IUser {
150
150
 
151
151
  public async updateUserBasicInfo(params: authModels.ModifyUserBasicInfoRequest): Promise<void> {
152
152
  await this.oauthInstance.authApi.updateUserBasicInfo({ ...params })
153
- this.setLocalUserInfo({ username: params.username })
153
+ await this.refresh()
154
154
  }
155
155
 
156
156
  /**
package/src/sbaseApi.ts CHANGED
@@ -355,6 +355,7 @@ export class SbaseApi {
355
355
  await this.signIn({
356
356
  username: params.username || params.email || this.formatPhone(params.phone),
357
357
  password: params.password,
358
+ ...(params.is_encrypt ? { isEncrypt: true, version: 'v2' } : {}),
358
359
  })
359
360
  const { data: { session } = {} } = await this.getSession()
360
361
 
@@ -881,7 +882,7 @@ export class SbaseApi {
881
882
  // 发送验证码
882
883
  const verificationInfo = await this.getVerification(verificationParams)
883
884
 
884
- await this.updateUserBasicInfo(restParams)
885
+ Object.keys(restParams).length > 0 && await this.updateUserBasicInfo(restParams)
885
886
 
886
887
  extraRes = {
887
888
  messageId: verificationInfo.verification_id,
@@ -904,7 +905,7 @@ export class SbaseApi {
904
905
  token: verifyParams.token,
905
906
  messageId: verificationInfo.verification_id,
906
907
  })
907
- await this.updateUserBasicInfo({ phone: params.phone })
908
+ await this.updateUserBasicInfo({ phone: this.formatPhone(params.phone) })
908
909
  } else {
909
910
  await this.verifyOtp({
910
911
  type: verificationType,
@@ -1446,7 +1447,7 @@ export class SbaseApi {
1446
1447
  // V2 API 兼容(使用 any 避免类型错误)
1447
1448
  uid: userInfo.uid,
1448
1449
  nickName: userInfo.nickName,
1449
- avatarUrl: userInfo.avatarUrl,
1450
+ avatarUrl: userInfo.avatarUrl || userInfo.picture,
1450
1451
  location: userInfo.location,
1451
1452
  hasPassword: userInfo.hasPassword,
1452
1453
  },
package/src/type.d.ts CHANGED
@@ -51,6 +51,7 @@ export interface SignInWithPasswordReq {
51
51
  email?: string // 邮箱(可选,与用户名、手机号三选一)
52
52
  phone?: string // 手机号(可选,与用户名、邮箱三选一)
53
53
  password: string // 密码(必填)
54
+ is_encrypt?: boolean // 是否加密,默认为false
54
55
  }
55
56
 
56
57
  // 通用响应类型