@nocobase/plugin-auth 0.21.0-alpha.8 → 0.21.0-alpha.9

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.
@@ -1,18 +1,18 @@
1
1
  module.exports = {
2
- "@nocobase/client": "0.21.0-alpha.8",
2
+ "@nocobase/client": "0.21.0-alpha.9",
3
3
  "react": "18.2.0",
4
4
  "react-router-dom": "6.21.0",
5
- "@nocobase/utils": "0.21.0-alpha.8",
6
- "@nocobase/auth": "0.21.0-alpha.8",
7
- "@nocobase/database": "0.21.0-alpha.8",
8
- "@nocobase/cache": "0.21.0-alpha.8",
9
- "@nocobase/server": "0.21.0-alpha.8",
10
- "@nocobase/test": "0.21.0-alpha.8",
5
+ "@nocobase/utils": "0.21.0-alpha.9",
6
+ "@nocobase/auth": "0.21.0-alpha.9",
7
+ "@nocobase/database": "0.21.0-alpha.9",
8
+ "@nocobase/cache": "0.21.0-alpha.9",
9
+ "@nocobase/server": "0.21.0-alpha.9",
10
+ "@nocobase/test": "0.21.0-alpha.9",
11
11
  "antd": "5.12.8",
12
12
  "@formily/react": "2.3.0",
13
13
  "@formily/shared": "2.3.0",
14
14
  "react-i18next": "11.18.6",
15
15
  "@emotion/css": "11.11.2",
16
16
  "@ant-design/icons": "5.2.6",
17
- "@nocobase/actions": "0.21.0-alpha.8"
17
+ "@nocobase/actions": "0.21.0-alpha.9"
18
18
  };
@@ -16,6 +16,7 @@
16
16
  "Please enter a valid username": "Please enter a valid username",
17
17
  "Please enter a valid email": "Please enter a valid email",
18
18
  "Please enter your username or email": "Please enter your username or email",
19
+ "Please enter a password": "Please enter a password",
19
20
  "SMS": "SMS",
20
21
  "Username/Email": "Username/Email",
21
22
  "Auth UID": "Auth UID",
@@ -16,6 +16,7 @@
16
16
  "Please enter a valid username": "请输入有效的用户名",
17
17
  "Please enter a valid email": "请输入有效的邮箱",
18
18
  "Please enter your username or email": "请输入用户名或邮箱",
19
+ "Please enter a password": "请输入密码",
19
20
  "SMS": "短信",
20
21
  "Username/Email": "用户名/邮箱",
21
22
  "Auth UID": "认证标识",
@@ -1 +1 @@
1
- {"name":"cron","description":"Cron jobs for your node","version":"2.4.4","author":"Nick Campbell <nicholas.j.campbell@gmail.com> (https://github.com/ncb000gt)","bugs":{"url":"https://github.com/kelektiv/node-cron/issues"},"repository":{"type":"git","url":"https://github.com/kelektiv/node-cron.git"},"main":"lib/cron","scripts":{"lint":"eslint {lib,tests}/*.js","test":"jest --coverage","test:watch":"jest --watch --coverage","test:types":"tsd","prepare":"husky install","release":"semantic-release"},"types":"types/index.d.ts","dependencies":{"@types/luxon":"~3.3.0","luxon":"~3.3.0"},"devDependencies":{"@commitlint/cli":"~17.6.6","@insurgentlab/commitlint-config":"^18.1.0","@insurgentlab/conventional-changelog-preset":"~6.0.3","@semantic-release/changelog":"~6.0.x","@semantic-release/commit-analyzer":"~9.0.x","@semantic-release/git":"~10.0.x","@semantic-release/github":"~8.1.x","@semantic-release/npm":"~10.0.x","@semantic-release/release-notes-generator":"~11.0.x","chai":"~4.2.x","eslint":"~8.36.x","eslint-config-prettier":"^8.7.x","eslint-config-standard":"~17.0.x","eslint-plugin-import":"~2.27.x","eslint-plugin-jest":"~27.2.x","eslint-plugin-n":"~15.6.x","eslint-plugin-prettier":"~4.2.x","eslint-plugin-promise":"~6.1.x","husky":"^8.0.3","jest":"~29.5.x","prettier":"~2.8.x","semantic-release":"~21.0.x","sinon":"^15.0.x","tsd":"^0.28.1"},"keywords":["cron","node cron","node-cron","schedule","scheduler","cronjob","cron job"],"license":"MIT","contributors":["Brandon der Blätter <https://interlucid.com/contact/> (https://github.com/intcreator)","Romain Beauxis <toots@rastageeks.org> (https://github.com/toots)","James Padolsey <> (https://github.com/jamespadolsey)","Finn Herpich <fh@three-heads.de> (https://github.com/ErrorProne)","Clifton Cunningham <clifton.cunningham@gmail.com> (https://github.com/cliftonc)","Eric Abouaf <eric.abouaf@gmail.com> (https://github.com/neyric)","humanchimp <morphcham@gmail.com> (https://github.com/humanchimp)","Craig Condon <craig@spiceapps.com> (https://github.com/spiceapps)","Dan Bear <daniel@hulu.com> (https://github.com/danhbear)","Vadim Baryshev <vadimbaryshev@gmail.com> (https://github.com/baryshev)","Leandro Ferrari <lfthomaz@gmail.com> (https://github.com/lfthomaz)","Gregg Zigler <greggzigler@gmail.com> (https://github.com/greggzigler)","Jordan Abderrachid <jabderrachid@gmail.com> (https://github.com/jordanabderrachid)","Masakazu Matsushita <matsukaz@gmail.com> (matsukaz)","Christopher Lunt <me@kirisu.co.uk> (https://github.com/kirisu)"],"jest":{"collectCoverage":true,"collectCoverageFrom":["lib/*.js"],"coverageThreshold":{"global":{"statements":80,"branches":80,"functions":70,"lines":80}}},"files":["lib","types","CHANGELOG.md","LICENSE","README.md"],"_lastModified":"2024-04-15T16:39:04.571Z"}
1
+ {"name":"cron","description":"Cron jobs for your node","version":"2.4.4","author":"Nick Campbell <nicholas.j.campbell@gmail.com> (https://github.com/ncb000gt)","bugs":{"url":"https://github.com/kelektiv/node-cron/issues"},"repository":{"type":"git","url":"https://github.com/kelektiv/node-cron.git"},"main":"lib/cron","scripts":{"lint":"eslint {lib,tests}/*.js","test":"jest --coverage","test:watch":"jest --watch --coverage","test:types":"tsd","prepare":"husky install","release":"semantic-release"},"types":"types/index.d.ts","dependencies":{"@types/luxon":"~3.3.0","luxon":"~3.3.0"},"devDependencies":{"@commitlint/cli":"~17.6.6","@insurgentlab/commitlint-config":"^18.1.0","@insurgentlab/conventional-changelog-preset":"~6.0.3","@semantic-release/changelog":"~6.0.x","@semantic-release/commit-analyzer":"~9.0.x","@semantic-release/git":"~10.0.x","@semantic-release/github":"~8.1.x","@semantic-release/npm":"~10.0.x","@semantic-release/release-notes-generator":"~11.0.x","chai":"~4.2.x","eslint":"~8.36.x","eslint-config-prettier":"^8.7.x","eslint-config-standard":"~17.0.x","eslint-plugin-import":"~2.27.x","eslint-plugin-jest":"~27.2.x","eslint-plugin-n":"~15.6.x","eslint-plugin-prettier":"~4.2.x","eslint-plugin-promise":"~6.1.x","husky":"^8.0.3","jest":"~29.5.x","prettier":"~2.8.x","semantic-release":"~21.0.x","sinon":"^15.0.x","tsd":"^0.28.1"},"keywords":["cron","node cron","node-cron","schedule","scheduler","cronjob","cron job"],"license":"MIT","contributors":["Brandon der Blätter <https://interlucid.com/contact/> (https://github.com/intcreator)","Romain Beauxis <toots@rastageeks.org> (https://github.com/toots)","James Padolsey <> (https://github.com/jamespadolsey)","Finn Herpich <fh@three-heads.de> (https://github.com/ErrorProne)","Clifton Cunningham <clifton.cunningham@gmail.com> (https://github.com/cliftonc)","Eric Abouaf <eric.abouaf@gmail.com> (https://github.com/neyric)","humanchimp <morphcham@gmail.com> (https://github.com/humanchimp)","Craig Condon <craig@spiceapps.com> (https://github.com/spiceapps)","Dan Bear <daniel@hulu.com> (https://github.com/danhbear)","Vadim Baryshev <vadimbaryshev@gmail.com> (https://github.com/baryshev)","Leandro Ferrari <lfthomaz@gmail.com> (https://github.com/lfthomaz)","Gregg Zigler <greggzigler@gmail.com> (https://github.com/greggzigler)","Jordan Abderrachid <jabderrachid@gmail.com> (https://github.com/jordanabderrachid)","Masakazu Matsushita <matsukaz@gmail.com> (matsukaz)","Christopher Lunt <me@kirisu.co.uk> (https://github.com/kirisu)"],"jest":{"collectCoverage":true,"collectCoverageFrom":["lib/*.js"],"coverageThreshold":{"global":{"statements":80,"branches":80,"functions":70,"lines":80}}},"files":["lib","types","CHANGELOG.md","LICENSE","README.md"],"_lastModified":"2024-04-16T15:04:35.265Z"}
@@ -20,6 +20,7 @@ __export(auth_exports, {
20
20
  default: () => auth_default
21
21
  });
22
22
  module.exports = __toCommonJS(auth_exports);
23
+ /* istanbul ignore file -- @preserve */
23
24
  var auth_default = {
24
25
  lostPassword: async (ctx, next) => {
25
26
  ctx.body = await ctx.auth.lostPassword();
@@ -41,14 +41,12 @@ class BasicAuth extends import_auth.BaseAuth {
41
41
  async validate() {
42
42
  const ctx = this.ctx;
43
43
  const {
44
- values: {
45
- account,
46
- // Username or email
47
- email,
48
- // Old parameter, compatible with old api
49
- password
50
- }
51
- } = ctx.action.params;
44
+ account,
45
+ // Username or email
46
+ email,
47
+ // Old parameter, compatible with old api
48
+ password
49
+ } = ctx.action.params.values || {};
52
50
  if (!account && !email) {
53
51
  ctx.throw(400, ctx.t("Please enter your username or email", { ns: import_preset.namespace }));
54
52
  }
@@ -81,12 +79,16 @@ class BasicAuth extends import_auth.BaseAuth {
81
79
  if (!/^[^@.<>"'/]{2,16}$/.test(username)) {
82
80
  ctx.throw(400, ctx.t("Please enter a valid username", { ns: import_preset.namespace }));
83
81
  }
82
+ if (!password) {
83
+ ctx.throw(400, ctx.t("Please enter a password", { ns: import_preset.namespace }));
84
+ }
84
85
  if (password !== confirm_password) {
85
86
  ctx.throw(400, ctx.t("The password is inconsistent, please re-enter", { ns: import_preset.namespace }));
86
87
  }
87
88
  const user = await User.create({ values: { username, password } });
88
89
  return user;
89
90
  }
91
+ /* istanbul ignore next -- @preserve */
90
92
  async lostPassword() {
91
93
  const ctx = this.ctx;
92
94
  const {
@@ -107,6 +109,7 @@ class BasicAuth extends import_auth.BaseAuth {
107
109
  await user.save();
108
110
  return user;
109
111
  }
112
+ /* istanbul ignore next -- @preserve */
110
113
  async resetPassword() {
111
114
  const ctx = this.ctx;
112
115
  const {
@@ -127,6 +130,7 @@ class BasicAuth extends import_auth.BaseAuth {
127
130
  await user.save();
128
131
  return user;
129
132
  }
133
+ /* istanbul ignore next -- @preserve */
130
134
  async getUserByResetToken() {
131
135
  const ctx = this.ctx;
132
136
  const { token } = ctx.action.params;
@@ -143,8 +147,11 @@ class BasicAuth extends import_auth.BaseAuth {
143
147
  async changePassword() {
144
148
  const ctx = this.ctx;
145
149
  const {
146
- values: { oldPassword, newPassword }
150
+ values: { oldPassword, newPassword, confirmPassword }
147
151
  } = ctx.action.params;
152
+ if (newPassword !== confirmPassword) {
153
+ ctx.throw(400, ctx.t("The password is inconsistent, please re-enter", { ns: import_preset.namespace }));
154
+ }
148
155
  const currentUser = ctx.auth.user;
149
156
  if (!currentUser) {
150
157
  ctx.throw(401);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-auth",
3
- "version": "0.21.0-alpha.8",
3
+ "version": "0.21.0-alpha.9",
4
4
  "main": "./dist/server/index.js",
5
5
  "homepage": "https://docs.nocobase.com/handbook/auth",
6
6
  "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/auth",
@@ -26,7 +26,7 @@
26
26
  "displayName.zh-CN": "用户认证",
27
27
  "description": "User authentication management, including password, SMS, and support for Single Sign-On (SSO) protocols, with extensibility.",
28
28
  "description.zh-CN": "用户认证管理,包括基础的密码认证、短信认证、SSO 协议的认证等,可扩展。",
29
- "gitHead": "bed69485709bc8e268285b50debfc1ebfd7a30c7",
29
+ "gitHead": "a6fe6c4ee532c04e5a50ec777bf76436ca624cbd",
30
30
  "keywords": [
31
31
  "Authentication"
32
32
  ]