dsh-tokenbank 0.1.4 → 0.1.6

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.
Files changed (2) hide show
  1. package/lib/client.js +8 -5
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -54,6 +54,7 @@ window.__ModuleLoader__.load({
54
54
  displayName: '昵称(可选)',
55
55
  code: '邮箱验证码',
56
56
  sendCode: '发送验证码',
57
+ codeInvalid: '验证码无效或已过期,请重新发送',
57
58
  codeSent: '已发送,请查收邮箱',
58
59
  captcha: '图形验证码',
59
60
  captchaCode: '输入图中字符',
@@ -141,6 +142,7 @@ window.__ModuleLoader__.load({
141
142
  displayName: 'Display name (optional)',
142
143
  code: 'Email code',
143
144
  sendCode: 'Send code',
145
+ codeInvalid: 'Code invalid or expired — please resend',
144
146
  codeSent: 'Sent — check your inbox',
145
147
  captcha: 'Captcha',
146
148
  captchaCode: 'Type the characters',
@@ -1068,14 +1070,13 @@ window.__ModuleLoader__.load({
1068
1070
 
1069
1071
  React.useEffect(function () {
1070
1072
  if (mode === 'login') refreshCaptcha()
1073
+ sent[1](false)
1071
1074
  }, [mode, refreshCaptcha])
1072
1075
 
1073
1076
  var submit = React.useCallback(async function () {
1074
1077
  busy[1](true); error[1]('')
1075
1078
  try {
1076
1079
  if (mode === 'register') {
1077
- await api('send-code', { email: email[0] })
1078
- sent[1](true)
1079
1080
  await api('register', {
1080
1081
  email: email[0], code: code[0], password: password[0],
1081
1082
  displayName: displayName[0], savePassword: savePassword[0],
@@ -1089,7 +1090,9 @@ window.__ModuleLoader__.load({
1089
1090
  }
1090
1091
  await onAuthed()
1091
1092
  } catch (err) {
1092
- error[1](String(err.message || err))
1093
+ var msg = String(err.message || err)
1094
+ if (mode === 'register' && /validation/i.test(msg)) msg = t('codeInvalid')
1095
+ error[1](msg)
1093
1096
  if (mode === 'login') refreshCaptcha()
1094
1097
  } finally {
1095
1098
  busy[1](false)
@@ -1130,8 +1133,6 @@ window.__ModuleLoader__.load({
1130
1133
  ),
1131
1134
  h(Field, { label: t('email') },
1132
1135
  h('input', { style: inputStyle, type: 'email', value: email[0], onChange: function (e) { email[1](e.target.value) } })),
1133
- h(Field, { label: t('password') },
1134
- h('input', { style: inputStyle, type: 'password', value: password[0], onChange: function (e) { password[1](e.target.value) } })),
1135
1136
  mode === 'register'
1136
1137
  ? h('div', { style: { display: 'flex', gap: 8, alignItems: 'flex-end' } },
1137
1138
  h('div', { style: { flex: 1 } },
@@ -1161,6 +1162,8 @@ window.__ModuleLoader__.load({
1161
1162
  })
1162
1163
  : null,
1163
1164
  ),
1165
+ h(Field, { label: t('password') },
1166
+ h('input', { style: inputStyle, type: 'password', value: password[0], onChange: function (e) { password[1](e.target.value) } })),
1164
1167
  error[0] ? h('div', { style: errorStyle }, error[0]) : null,
1165
1168
  h('button', {
1166
1169
  type: 'button', style: primaryButtonStyle, disabled: busy[0],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-tokenbank",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "DSH 免费模型:一键注册 TokenBank 领免费 APIKey 送 $5 体验金,免费 GLM 模型直接进模型列表;自带余额查询、API Key 密钥托管(临时额度转永久)、每日签到、充值入口(支付宝),获取免费模型无需自建中转。致敬 dsh-our-free-model。官网 https://bank.skillpie.cn",
5
5
  "type": "module",
6
6
  "license": "MIT",