@cloudbase/auth 2.25.10 → 2.26.0

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/src/index.ts CHANGED
@@ -1574,6 +1574,13 @@ class Auth {
1574
1574
  * @returns Promise<SignInWithOtpRes>
1575
1575
  */
1576
1576
  async signInWithOtp(params: SignInWithOtpReq): Promise<SignInWithOtpRes> {
1577
+ if (params.options?.shouldCreateUser === undefined || !!params.options?.shouldCreateUser) {
1578
+ return this.signUp({
1579
+ email: params.email,
1580
+ phone: params.phone,
1581
+ })
1582
+ }
1583
+
1577
1584
  try {
1578
1585
  // 参数校验:email或phone必填其一
1579
1586
  this.validateAtLeastOne(params, [['email'], ['phone']], 'You must provide either an email or phone number')
package/src/type.ts CHANGED
@@ -227,6 +227,9 @@ export interface VerifyOtpReq {
227
227
  export interface SignInWithOtpReq {
228
228
  email?: string // 邮箱(可选,与手机号二选一)
229
229
  phone?: string // 手机号(可选,与邮箱二选一)
230
+ options?: {
231
+ shouldCreateUser?: boolean // 如果用户不存在是否创建用户,默认为true
232
+ }
230
233
  }
231
234
 
232
235
  /**