@cloudbase/lowcode-builder 1.10.30 → 1.10.32

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/lowcode-builder",
3
- "version": "1.10.30",
3
+ "version": "1.10.32",
4
4
  "description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
5
5
  "author": "yhsunshining@gmail.com",
6
6
  "homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
@@ -316,7 +316,7 @@ Component({
316
316
  verificationInfo,
317
317
  loginOnly: !this.data.settingData.userRegistry?.enable,
318
318
  isRegister: this.data.isRegister,
319
- hasRegisterConfig: this.data.userRegistry?.enable && this.data.userRegistry?.web?.length, // 有注册配置,才会走注册配置的判断
319
+ hasRegisterConfig: this.data.settingData.userRegistry?.enable && !!this.data.settingData.userRegistry?.miniprogram?.find(v => v.id === this.data.currentLoginType), // 有注册配置,才会走注册配置的判断
320
320
  callback: (err, data) => {
321
321
  if (err) {
322
322
  // 错误处理:更新尝试次数
@@ -609,6 +609,14 @@ Component({
609
609
  loginSuccessCallBack(this);
610
610
  },
611
611
  methodClick(e) {
612
+ if (this.data.disableLoginSubmit) {
613
+ wx.showToast({
614
+ title: '请先阅读并同意协议',
615
+ icon: 'none'
616
+ })
617
+ return;
618
+ };
619
+
612
620
  const {
613
621
  id
614
622
  } = e.currentTarget.dataset.item || {};
@@ -620,13 +628,6 @@ Component({
620
628
  })
621
629
 
622
630
  if (AUTO_LOGIN_TYPE.includes(currentLoginType)) {
623
- if (this.data.disableLoginSubmit) {
624
- wx.showToast({
625
- title: '请先阅读并同意协议',
626
- icon: 'none'
627
- })
628
- return;
629
- };
630
631
  this.dealOpenIdOrUnionIdLogin(currentLoginType)
631
632
  return;
632
633
  }
@@ -4,4 +4,3 @@ export const emailVerifyInfoKey = 'sso_email_verifyInfo'; // 获取邮箱信息
4
4
  export const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
5
5
  export const verifyCodeFailedLimit = 8; // 同一个验证码使用8次即提示错误
6
6
  export const verifyDelay = 60; // 获取验证码倒计时,单位s
7
- export const loginOnly = false;
@@ -39,8 +39,12 @@ export default async function loginByEmail(
39
39
  };
40
40
  }
41
41
 
42
- if (isRegister && verificationInfo.isUser && verificationInfo.email === email) {
43
- throw { error: 'user has already registered, please log in directly' };
42
+ if (isRegister && verificationInfo.isUser) {
43
+ throw new Error('user has already registered, please log in directly');
44
+ }
45
+
46
+ if (!isRegister && !verificationInfo.isUser) {
47
+ throw { error: 'user not registered, please register first' };
44
48
  }
45
49
 
46
50
  // 校验
@@ -63,7 +67,7 @@ export default async function loginByEmail(
63
67
  provider_token: bindInfo.providerToken,
64
68
  });
65
69
  }
66
- } else if (!hasRegisterConfig || isRegister) {
70
+ } else if (hasRegisterConfig && isRegister) {
67
71
  // 3. 注册
68
72
  await auth.signUp({
69
73
  email,
@@ -1,11 +1,11 @@
1
1
  import { parseSmsLoginError } from './errorHandler';
2
2
  import { app } from '../../../../../app/weapps-api';
3
3
  import loginSuccessCallBack from './loginSuccessCallBack';
4
- import { phoneVerifyInfoKey, verifyCodeFailedLimit, loginOnly } from './contants';
4
+ import { phoneVerifyInfoKey, verifyCodeFailedLimit } from './contants';
5
5
 
6
6
  export default async function loginBySms(
7
7
  instance,
8
- { callback, verificationInfo, verificationCode, phoneNum, bindInfo, isRegister, hasRegisterConfig },
8
+ { callback, verificationInfo, verificationCode, phoneNum, bindInfo, loginOnly, isRegister, hasRegisterConfig },
9
9
  ) {
10
10
  wx.showLoading({ mask: true });
11
11
  const { usedCount = 0 } = wx.getStorageSync(phoneVerifyInfoKey) || {};
@@ -18,8 +18,12 @@ export default async function loginBySms(
18
18
  throw { error: 'get_verify_code' };
19
19
  }
20
20
 
21
- if (isRegister && verificationInfo.isUser && verificationInfo.phoneNum === phoneNum) {
22
- throw { error: 'user has already registered, please log in directly' };
21
+ if (isRegister && verificationInfo.isUser) {
22
+ throw new Error('user has already registered, please log in directly');
23
+ }
24
+
25
+ if (!isRegister && !verificationInfo.isUser) {
26
+ throw { error: 'user not registered, please register first' };
23
27
  }
24
28
 
25
29
  // 校验
@@ -44,7 +48,7 @@ export default async function loginBySms(
44
48
  provider_token: bindInfo.providerToken,
45
49
  });
46
50
  }
47
- } else if (!hasRegisterConfig || isRegister) {
51
+ } else if (hasRegisterConfig && isRegister) {
48
52
  // 自定义应用走signUp逻辑
49
53
  await auth.signUp({
50
54
  phone_number: `+86 ${phoneNum}`,
@@ -60,7 +64,7 @@ export default async function loginBySms(
60
64
  } catch (e) {
61
65
  wx.hideLoading();
62
66
  wx.showModal({
63
- title: '验证码登录失败',
67
+ title: `验证码${isRegister ? '注册' : '登录'}失败`,
64
68
  content: parseSmsLoginError(e),
65
69
  });
66
70
  callback?.(new Error(parseSmsLoginError(e)));