@nocobase/plugin-auth 2.2.0-beta.9 → 3.0.0-alpha.1
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/dist/client/index.js +1 -1
- package/dist/client-v2/217.1510705562d97555.js +10 -0
- package/dist/client-v2/795.7100439b59804662.js +10 -0
- package/dist/client-v2/841.7a31cfa7c5c79d2d.js +10 -0
- package/dist/client-v2/9.c10c60a4ecc4256d.js +10 -0
- package/dist/client-v2/authRoutePaths.d.ts +26 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/client-v2/pages/AuthenticatorsPage.d.ts +26 -0
- package/dist/externalVersion.js +11 -11
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -2
- package/dist/locale/de-DE.json +2 -1
- package/dist/locale/en-US.json +4 -1
- package/dist/locale/es-ES.json +2 -1
- package/dist/locale/fr-FR.json +2 -1
- package/dist/locale/hu-HU.json +2 -1
- package/dist/locale/id-ID.json +2 -1
- package/dist/locale/it-IT.json +2 -1
- package/dist/locale/ja-JP.json +2 -1
- package/dist/locale/ko-KR.json +2 -1
- package/dist/locale/nl-NL.json +2 -1
- package/dist/locale/pt-BR.json +2 -1
- package/dist/locale/ru-RU.json +2 -1
- package/dist/locale/tr-TR.json +2 -1
- package/dist/locale/uk-UA.json +2 -1
- package/dist/locale/vi-VN.json +2 -1
- package/dist/locale/zh-CN.json +4 -1
- package/dist/locale/zh-TW.json +2 -1
- package/dist/node_modules/cron/package.json +1 -1
- package/dist/node_modules/ms/package.json +1 -1
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +9 -1
- package/dist/server/locale/en-US.json +2 -1
- package/dist/server/locale/zh-CN.json +3 -2
- package/dist/server/plugin.js +3 -1
- package/dist/server/token-controller.d.ts +1 -0
- package/dist/server/token-controller.js +11 -8
- package/dist/server/utils/authRedirect.d.ts +30 -0
- package/dist/server/utils/authRedirect.js +93 -0
- package/dist/server/utils/buildRedirectPath.js +19 -0
- package/dist/server/utils/resolveSubAppSegment.d.ts +17 -0
- package/dist/server/utils/resolveSubAppSegment.js +82 -0
- package/package.json +2 -2
- package/dist/client-v2/217.09744ff679406aff.js +0 -10
- package/dist/client-v2/795.b26178560fd03daa.js +0 -10
- package/dist/client-v2/841.ac9bfbb0615510e5.js +0 -10
- package/dist/client-v2/9.5301763a7da120fa.js +0 -10
package/dist/locale/uk-UA.json
CHANGED
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"The username or email is incorrect, please re-enter": "The username or email is incorrect, please re-enter",
|
|
69
69
|
"The username/email or password is incorrect, please re-enter": "The username/email or password is incorrect, please re-enter",
|
|
70
70
|
"The validity period of each issued API Token. After the Token expires, if it is within the session validity period and has not exceeded the refresh limit, the server will automatically issue a new Token to maintain the user session, otherwise the user is required to log in again. (Each Token can only be refreshed once)": "The validity period of each issued API Token. After the Token expires, if it is within the session validity period and has not exceeded the refresh limit, the server will automatically issue a new Token to maintain the user session, otherwise the user is required to log in again. (Each Token can only be refreshed once)",
|
|
71
|
+
"Invalid sign-in origin": "Недійсне джерело входу",
|
|
71
72
|
"Token expired": "Token expired",
|
|
72
73
|
"Token policy": "Token policy",
|
|
73
74
|
"Token validity period": "Token validity period",
|
|
@@ -81,4 +82,4 @@
|
|
|
81
82
|
"defaultResetPasswordEmailContentHTML": "<p>Hello {{$user.username}},</p>\n\n<p>We received a request to reset the password for your {{$systemSettings.title}} account.</p>\n\n<p>Please click the link below to set your new password:</p>\n\n<p>\n <a href=\"{{$resetLink}}\">Reset Your Password</a>\n</p>\n\n<p>\n If you did not request a password reset, please ignore this email. Your password will remain unchanged.\n</p>\n\n<p>\n Please note: For your security, this password reset link will expire in <strong>{{$resetLinkExpiration}} minutes</strong>.\n</p>\n\n<p>If you encounter any issues resetting your password, please contact our support team.</p>\n\n<p>\n Thanks,<br>\n The {{$systemSettings.title}} Team\n</p>",
|
|
82
83
|
"defaultResetPasswordEmailContentText": "Hello {{$user.username}},\n\nWe received a request to reset the password for your {{$systemSettings.title}} account.\n\nPlease click the link below to set your new password:\n\n{{$resetLink}}\n\nIf you did not request a password reset, please ignore this email. Your password will remain unchanged.\n\nPlease note: For your security, this password reset link will expire in {{$resetLinkExpiration}} minutes.\n\nIf you encounter any issues resetting your password, please contact our support team.\n\nThanks, The {{$systemSettings.title}} Team",
|
|
83
84
|
"defaultResetPasswordEmailSubject": "Reset your password for {{$systemSettings.title}}"
|
|
84
|
-
}
|
|
85
|
+
}
|
package/dist/locale/vi-VN.json
CHANGED
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"The username or email is incorrect, please re-enter": "The username or email is incorrect, please re-enter",
|
|
69
69
|
"The username/email or password is incorrect, please re-enter": "The username/email or password is incorrect, please re-enter",
|
|
70
70
|
"The validity period of each issued API Token. After the Token expires, if it is within the session validity period and has not exceeded the refresh limit, the server will automatically issue a new Token to maintain the user session, otherwise the user is required to log in again. (Each Token can only be refreshed once)": "The validity period of each issued API Token. After the Token expires, if it is within the session validity period and has not exceeded the refresh limit, the server will automatically issue a new Token to maintain the user session, otherwise the user is required to log in again. (Each Token can only be refreshed once)",
|
|
71
|
+
"Invalid sign-in origin": "Nguồn đăng nhập không hợp lệ",
|
|
71
72
|
"Token expired": "Token expired",
|
|
72
73
|
"Token policy": "Token policy",
|
|
73
74
|
"Token validity period": "Token validity period",
|
|
@@ -81,4 +82,4 @@
|
|
|
81
82
|
"defaultResetPasswordEmailContentHTML": "<p>Hello {{$user.username}},</p>\n\n<p>We received a request to reset the password for your {{$systemSettings.title}} account.</p>\n\n<p>Please click the link below to set your new password:</p>\n\n<p>\n <a href=\"{{$resetLink}}\">Reset Your Password</a>\n</p>\n\n<p>\n If you did not request a password reset, please ignore this email. Your password will remain unchanged.\n</p>\n\n<p>\n Please note: For your security, this password reset link will expire in <strong>{{$resetLinkExpiration}} minutes</strong>.\n</p>\n\n<p>If you encounter any issues resetting your password, please contact our support team.</p>\n\n<p>\n Thanks,<br>\n The {{$systemSettings.title}} Team\n</p>",
|
|
82
83
|
"defaultResetPasswordEmailContentText": "Hello {{$user.username}},\n\nWe received a request to reset the password for your {{$systemSettings.title}} account.\n\nPlease click the link below to set your new password:\n\n{{$resetLink}}\n\nIf you did not request a password reset, please ignore this email. Your password will remain unchanged.\n\nPlease note: For your security, this password reset link will expire in {{$resetLinkExpiration}} minutes.\n\nIf you encounter any issues resetting your password, please contact our support team.\n\nThanks, The {{$systemSettings.title}} Team",
|
|
83
84
|
"defaultResetPasswordEmailSubject": "Reset your password for {{$systemSettings.title}}"
|
|
84
|
-
}
|
|
85
|
+
}
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"Days": "天",
|
|
14
14
|
"Email channel not found": "未找到邮件通道",
|
|
15
15
|
"Enable forget password": "启用忘记密码功能",
|
|
16
|
+
"Failed to load authenticator": "加载认证器失败",
|
|
16
17
|
"Expired token refresh limit": "过期 Token 刷新时限",
|
|
17
18
|
"Forgot password": "忘记密码",
|
|
18
19
|
"Go to login": "前往登录",
|
|
@@ -68,6 +69,8 @@
|
|
|
68
69
|
"The username or email is incorrect, please re-enter": "用户名或邮箱有误,请重新输入",
|
|
69
70
|
"The username/email or password is incorrect, please re-enter": "用户名/邮箱或密码有误,请重新输入",
|
|
70
71
|
"The validity period of each issued API Token. After the Token expires, if it is within the session validity period and has not exceeded the refresh limit, the server will automatically issue a new Token to maintain the user session, otherwise the user is required to log in again. (Each Token can only be refreshed once)": "每次签发的 API Token 的有效期。Token 过期后,如果处于会话有效期内,并且没有超过刷新时限,服务端将自动签发新 Token 以保持用户会话,否则要求用户重新登录。(每个 Token 只能被刷新一次)",
|
|
72
|
+
"Invalid CSRF token": "CSRF token 无效",
|
|
73
|
+
"Invalid sign-in origin": "登录来源无效",
|
|
71
74
|
"Token expired": "令牌已过期",
|
|
72
75
|
"Token policy": "Token 策略",
|
|
73
76
|
"Token validity period": "Token 有效期",
|
|
@@ -81,4 +84,4 @@
|
|
|
81
84
|
"defaultResetPasswordEmailContentHTML": "<p>您好 {{$user.username}},</p>\n\n<p>我们收到了重置您 {{$systemSettings.title}} 账户密码的请求。</p>\n\n<p>请点击下面的链接设置您的新密码:</p>\n\n<p>\n <a href=\"{{$resetLink}}\">重置您的密码</a>\n</p>\n\n<p>\n 如果您没有请求重置密码,请忽略此邮件。您的密码将保持不变。\n</p>\n\n<p>\n 请注意:为了您的安全,此密码重置链接将在 <strong>{{$resetLinkExpiration}} 分钟</strong>后过期。\n</p>\n\n<p>如果您在重置密码时遇到任何问题,请联系我们的支持团队。</p>\n\n<p>\n 谢谢,<br>\n {{$systemSettings.title}} 团队\n</p>",
|
|
82
85
|
"defaultResetPasswordEmailContentText": "您好 {{$user.username}},\n\n我们收到了重置您 {{$systemSettings.title}} 账户密码的请求。\n\n请点击下面的链接设置您的新密码:\n\n{{$resetLink}}\n\n如果您没有请求重置密码,请忽略此邮件。您的密码将保持不变。\n\n请注意:为了您的安全,此密码重置链接将在 {{$resetLinkExpiration}} 分钟后过期。\n\n如果您在重置密码时遇到任何问题,请联系我们的支持团队。\n\n谢谢,{{$systemSettings.title}} 团队",
|
|
83
86
|
"defaultResetPasswordEmailSubject": "重置您的 {{$systemSettings.title}} 密码"
|
|
84
|
-
}
|
|
87
|
+
}
|
package/dist/locale/zh-TW.json
CHANGED
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"The username or email is incorrect, please re-enter": "The username or email is incorrect, please re-enter",
|
|
69
69
|
"The username/email or password is incorrect, please re-enter": "The username/email or password is incorrect, please re-enter",
|
|
70
70
|
"The validity period of each issued API Token. After the Token expires, if it is within the session validity period and has not exceeded the refresh limit, the server will automatically issue a new Token to maintain the user session, otherwise the user is required to log in again. (Each Token can only be refreshed once)": "The validity period of each issued API Token. After the Token expires, if it is within the session validity period and has not exceeded the refresh limit, the server will automatically issue a new Token to maintain the user session, otherwise the user is required to log in again. (Each Token can only be refreshed once)",
|
|
71
|
+
"Invalid sign-in origin": "登入來源無效",
|
|
71
72
|
"Token expired": "Token expired",
|
|
72
73
|
"Token policy": "Token policy",
|
|
73
74
|
"Token validity period": "Token validity period",
|
|
@@ -81,4 +82,4 @@
|
|
|
81
82
|
"defaultResetPasswordEmailContentHTML": "<p>Hello {{$user.username}},</p>\n\n<p>We received a request to reset the password for your {{$systemSettings.title}} account.</p>\n\n<p>Please click the link below to set your new password:</p>\n\n<p>\n <a href=\"{{$resetLink}}\">Reset Your Password</a>\n</p>\n\n<p>\n If you did not request a password reset, please ignore this email. Your password will remain unchanged.\n</p>\n\n<p>\n Please note: For your security, this password reset link will expire in <strong>{{$resetLinkExpiration}} minutes</strong>.\n</p>\n\n<p>If you encounter any issues resetting your password, please contact our support team.</p>\n\n<p>\n Thanks,<br>\n The {{$systemSettings.title}} Team\n</p>",
|
|
82
83
|
"defaultResetPasswordEmailContentText": "Hello {{$user.username}},\n\nWe received a request to reset the password for your {{$systemSettings.title}} account.\n\nPlease click the link below to set your new password:\n\n{{$resetLink}}\n\nIf you did not request a password reset, please ignore this email. Your password will remain unchanged.\n\nPlease note: For your security, this password reset link will expire in {{$resetLinkExpiration}} minutes.\n\nIf you encounter any issues resetting your password, please contact our support team.\n\nThanks, The {{$systemSettings.title}} Team",
|
|
83
84
|
"defaultResetPasswordEmailSubject": "Reset your password for {{$systemSettings.title}}"
|
|
84
|
-
}
|
|
85
|
+
}
|
|
@@ -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":"2026-07-
|
|
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":"2026-07-30T03:55:23.884Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"ms","version":"2.1.3","description":"Tiny millisecond conversion utility","repository":"vercel/ms","main":"./index","files":["index.js"],"scripts":{"precommit":"lint-staged","lint":"eslint lib/* bin/*","test":"mocha tests.js"},"eslintConfig":{"extends":"eslint:recommended","env":{"node":true,"es6":true}},"lint-staged":{"*.js":["npm run lint","prettier --single-quote --write","git add"]},"license":"MIT","devDependencies":{"eslint":"4.18.2","expect.js":"0.3.1","husky":"0.14.3","lint-staged":"5.0.0","mocha":"4.0.1","prettier":"2.0.5"},"_lastModified":"2026-07-
|
|
1
|
+
{"name":"ms","version":"2.1.3","description":"Tiny millisecond conversion utility","repository":"vercel/ms","main":"./index","files":["index.js"],"scripts":{"precommit":"lint-staged","lint":"eslint lib/* bin/*","test":"mocha tests.js"},"eslintConfig":{"extends":"eslint:recommended","env":{"node":true,"es6":true}},"lint-staged":{"*.js":["npm run lint","prettier --single-quote --write","git add"]},"license":"MIT","devDependencies":{"eslint":"4.18.2","expect.js":"0.3.1","husky":"0.14.3","lint-staged":"5.0.0","mocha":"4.0.1","prettier":"2.0.5"},"_lastModified":"2026-07-30T03:55:23.970Z"}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -12,5 +12,8 @@ export { presetAuthType } from '../preset';
|
|
|
12
12
|
export { defaultTokenPolicyConfig } from '../constants';
|
|
13
13
|
export { buildRedirectPath, getModernClientPrefix, resolveSigninPrefix } from './utils/buildRedirectPath';
|
|
14
14
|
export type { BuildRedirectPathOptions, ResolveSigninPrefixOptions } from './utils/buildRedirectPath';
|
|
15
|
+
export { resolveSubAppSegment } from './utils/resolveSubAppSegment';
|
|
16
|
+
export { appendAuthRedirectQuery, resolveAuthRedirect } from './utils/authRedirect';
|
|
17
|
+
export type { AuthRedirectOriginContext } from './utils/authRedirect';
|
|
15
18
|
export { default } from './plugin';
|
|
16
19
|
export * from '../constants';
|
package/dist/server/index.js
CHANGED
|
@@ -39,12 +39,15 @@ var server_exports = {};
|
|
|
39
39
|
__export(server_exports, {
|
|
40
40
|
AuthModel: () => import_authenticator.AuthModel,
|
|
41
41
|
BasicAuth: () => import_basic_auth.BasicAuth,
|
|
42
|
+
appendAuthRedirectQuery: () => import_authRedirect.appendAuthRedirectQuery,
|
|
42
43
|
buildRedirectPath: () => import_buildRedirectPath.buildRedirectPath,
|
|
43
44
|
default: () => import_plugin.default,
|
|
44
45
|
defaultTokenPolicyConfig: () => import_constants.defaultTokenPolicyConfig,
|
|
45
46
|
getModernClientPrefix: () => import_buildRedirectPath.getModernClientPrefix,
|
|
46
47
|
presetAuthType: () => import_preset.presetAuthType,
|
|
47
|
-
|
|
48
|
+
resolveAuthRedirect: () => import_authRedirect.resolveAuthRedirect,
|
|
49
|
+
resolveSigninPrefix: () => import_buildRedirectPath.resolveSigninPrefix,
|
|
50
|
+
resolveSubAppSegment: () => import_resolveSubAppSegment.resolveSubAppSegment
|
|
48
51
|
});
|
|
49
52
|
module.exports = __toCommonJS(server_exports);
|
|
50
53
|
var import_basic_auth = require("./basic-auth");
|
|
@@ -52,16 +55,21 @@ var import_authenticator = require("./model/authenticator");
|
|
|
52
55
|
var import_preset = require("../preset");
|
|
53
56
|
var import_constants = require("../constants");
|
|
54
57
|
var import_buildRedirectPath = require("./utils/buildRedirectPath");
|
|
58
|
+
var import_resolveSubAppSegment = require("./utils/resolveSubAppSegment");
|
|
59
|
+
var import_authRedirect = require("./utils/authRedirect");
|
|
55
60
|
var import_plugin = __toESM(require("./plugin"));
|
|
56
61
|
__reExport(server_exports, require("../constants"), module.exports);
|
|
57
62
|
// Annotate the CommonJS export names for ESM import in node:
|
|
58
63
|
0 && (module.exports = {
|
|
59
64
|
AuthModel,
|
|
60
65
|
BasicAuth,
|
|
66
|
+
appendAuthRedirectQuery,
|
|
61
67
|
buildRedirectPath,
|
|
62
68
|
defaultTokenPolicyConfig,
|
|
63
69
|
getModernClientPrefix,
|
|
64
70
|
presetAuthType,
|
|
71
|
+
resolveAuthRedirect,
|
|
65
72
|
resolveSigninPrefix,
|
|
73
|
+
resolveSubAppSegment,
|
|
66
74
|
...require("../constants")
|
|
67
75
|
});
|
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
"The password is incorrect, please re-enter": "The password is incorrect, please re-enter",
|
|
5
5
|
"Not a valid cellphone number, please re-enter": "Not a valid cellphone number, please re-enter",
|
|
6
6
|
"The phone number has been registered, please login directly": "The phone number has been registered, please login directly",
|
|
7
|
-
"The phone number is not registered, please register first": "The phone number is not registered, please register first"
|
|
7
|
+
"The phone number is not registered, please register first": "The phone number is not registered, please register first",
|
|
8
|
+
"Invalid CSRF token": "Invalid CSRF token"
|
|
8
9
|
}
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
"The phone number is not registered, please register first": "手机号未注册,请先注册",
|
|
7
7
|
"Please keep and enable at least one authenticator": "请至少保留并启用一个认证器",
|
|
8
8
|
"Please enter your username or email": "请输入用户名或邮箱",
|
|
9
|
-
"Please enter a valid username": "请输入有效的用户名"
|
|
10
|
-
|
|
9
|
+
"Please enter a valid username": "请输入有效的用户名",
|
|
10
|
+
"Invalid CSRF token": "CSRF token 无效"
|
|
11
|
+
}
|
package/dist/server/plugin.js
CHANGED
|
@@ -136,7 +136,9 @@ class PluginAuthServer extends import_server.Plugin {
|
|
|
136
136
|
([action, handler]) => this.app.resourceManager.registerActionHandler(`authenticators:${action}`, handler)
|
|
137
137
|
);
|
|
138
138
|
["signIn", "signUp"].forEach((action) => this.app.acl.allow("auth", action));
|
|
139
|
-
["check", "signOut", "changePassword"].forEach(
|
|
139
|
+
["check", "signOut", "syncCookies", "changePassword"].forEach(
|
|
140
|
+
(action) => this.app.acl.allow("auth", action, "loggedIn")
|
|
141
|
+
);
|
|
140
142
|
["lostPassword", "resetPassword", "checkResetToken"].forEach(
|
|
141
143
|
(action) => this.app.acl.allow("auth", action, "public")
|
|
142
144
|
);
|
|
@@ -26,6 +26,7 @@ export declare class TokenController implements TokenControlService {
|
|
|
26
26
|
getConfig(): Promise<NumericTokenPolicyConfig>;
|
|
27
27
|
setConfig(config: TokenPolicyConfig): Promise<void>;
|
|
28
28
|
removeSessionExpiredTokens(userId: number): Promise<number>;
|
|
29
|
+
private cleanupSessionExpiredTokens;
|
|
29
30
|
add({ userId, authenticator }: {
|
|
30
31
|
userId: number;
|
|
31
32
|
authenticator?: string;
|
|
@@ -93,6 +93,13 @@ class TokenController {
|
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
+
async cleanupSessionExpiredTokens(userId) {
|
|
97
|
+
try {
|
|
98
|
+
await this.removeSessionExpiredTokens(userId);
|
|
99
|
+
} catch (err) {
|
|
100
|
+
this.logger.error(err, { module: "auth", submodule: "token-controller", method: "removeSessionExpiredTokens" });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
96
103
|
async add({ userId, authenticator }) {
|
|
97
104
|
const jti = (0, import_crypto.randomUUID)();
|
|
98
105
|
const currTS = Date.now();
|
|
@@ -105,14 +112,10 @@ class TokenController {
|
|
|
105
112
|
authenticator
|
|
106
113
|
};
|
|
107
114
|
await this.setTokenInfo(jti, data);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
this.removeSessionExpiredTokens(userId);
|
|
113
|
-
}
|
|
114
|
-
} catch (err) {
|
|
115
|
-
this.logger.error(err, { module: "auth", submodule: "token-controller", method: "removeSessionExpiredTokens" });
|
|
115
|
+
if (process.env.DB_DIALECT === "sqlite") {
|
|
116
|
+
await this.cleanupSessionExpiredTokens(userId);
|
|
117
|
+
} else {
|
|
118
|
+
this.cleanupSessionExpiredTokens(userId);
|
|
116
119
|
}
|
|
117
120
|
return data;
|
|
118
121
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { type OriginContext } from '@nocobase/utils';
|
|
10
|
+
import { type BuildRedirectPathOptions } from './buildRedirectPath';
|
|
11
|
+
export interface AuthRedirectOriginContext extends OriginContext {
|
|
12
|
+
t?(key: string, options?: {
|
|
13
|
+
ns?: string;
|
|
14
|
+
}): string;
|
|
15
|
+
throw(status: number, message: string): never;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resolve an SSO callback target without creating an open redirect.
|
|
19
|
+
*
|
|
20
|
+
* Existing NocoBase clients use root-relative paths and still need the app
|
|
21
|
+
* public path/sub-app prefix handling provided by `buildRedirectPath`.
|
|
22
|
+
* Standalone Portal development runs on another origin, so an absolute target
|
|
23
|
+
* is also accepted when that origin is trusted by the server's CORS policy.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveAuthRedirect(ctx: AuthRedirectOriginContext, { appPublicPath, subAppSegment, target }: BuildRedirectPathOptions): {
|
|
26
|
+
safeRedirect: string;
|
|
27
|
+
target: string;
|
|
28
|
+
};
|
|
29
|
+
/** Append or replace callback parameters while preserving query and hash. */
|
|
30
|
+
export declare function appendAuthRedirectQuery(target: string, params: Record<string, string | number | boolean | null | undefined>): string;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var authRedirect_exports = {};
|
|
28
|
+
__export(authRedirect_exports, {
|
|
29
|
+
appendAuthRedirectQuery: () => appendAuthRedirectQuery,
|
|
30
|
+
resolveAuthRedirect: () => resolveAuthRedirect
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(authRedirect_exports);
|
|
33
|
+
var import_utils = require("@nocobase/utils");
|
|
34
|
+
var import_preset = require("../../preset");
|
|
35
|
+
var import_buildRedirectPath = require("./buildRedirectPath");
|
|
36
|
+
function getInvalidOriginMessage(ctx) {
|
|
37
|
+
var _a;
|
|
38
|
+
return ((_a = ctx.t) == null ? void 0 : _a.call(ctx, "Invalid sign-in origin", { ns: import_preset.namespace })) || "Invalid sign-in origin";
|
|
39
|
+
}
|
|
40
|
+
function isRootRelativePath(value) {
|
|
41
|
+
return value.startsWith("/") && !value.startsWith("//") && !value.startsWith("/\\");
|
|
42
|
+
}
|
|
43
|
+
function isPortalPath(value, appPublicPath) {
|
|
44
|
+
const normalizedAppPublicPath = (appPublicPath || "").replace(/\/+$/, "");
|
|
45
|
+
const pathname = value.split(/[?#]/, 1)[0];
|
|
46
|
+
if (normalizedAppPublicPath && !pathname.startsWith(`${normalizedAppPublicPath}/`)) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const pathnameWithinPublicPath = pathname.slice(normalizedAppPublicPath.length);
|
|
50
|
+
return pathnameWithinPublicPath === "/x" || pathnameWithinPublicPath.startsWith("/x/");
|
|
51
|
+
}
|
|
52
|
+
function resolveAbsoluteUrl(ctx, value) {
|
|
53
|
+
let url;
|
|
54
|
+
try {
|
|
55
|
+
url = new URL(value);
|
|
56
|
+
} catch {
|
|
57
|
+
ctx.throw(400, getInvalidOriginMessage(ctx));
|
|
58
|
+
}
|
|
59
|
+
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password) {
|
|
60
|
+
ctx.throw(400, getInvalidOriginMessage(ctx));
|
|
61
|
+
}
|
|
62
|
+
const whitelist = (0, import_utils.getCorsWhitelist)();
|
|
63
|
+
if (!(0, import_utils.isSameOrigin)(ctx, url.origin) && !(whitelist == null ? void 0 : whitelist.has(url.origin))) {
|
|
64
|
+
ctx.throw(400, getInvalidOriginMessage(ctx));
|
|
65
|
+
}
|
|
66
|
+
return url;
|
|
67
|
+
}
|
|
68
|
+
function resolveSafeAuthRedirect(ctx, target) {
|
|
69
|
+
const value = typeof target === "string" ? target.trim() : "";
|
|
70
|
+
if (isRootRelativePath(value)) return value;
|
|
71
|
+
return value ? resolveAbsoluteUrl(ctx, value).toString() : null;
|
|
72
|
+
}
|
|
73
|
+
function resolveAuthRedirect(ctx, { appPublicPath, subAppSegment, target }) {
|
|
74
|
+
const safeRedirect = resolveSafeAuthRedirect(ctx, target) || "/admin";
|
|
75
|
+
const resolvedTarget = isRootRelativePath(safeRedirect) && !isPortalPath(safeRedirect, appPublicPath) ? (0, import_buildRedirectPath.buildRedirectPath)({ appPublicPath, subAppSegment, target: safeRedirect }) : safeRedirect;
|
|
76
|
+
return { safeRedirect, target: resolvedTarget };
|
|
77
|
+
}
|
|
78
|
+
function appendAuthRedirectQuery(target, params) {
|
|
79
|
+
const isAbsolute = /^[a-z][a-z\d+.-]*:/i.test(target);
|
|
80
|
+
const url = new URL(target, "http://nocobase.local");
|
|
81
|
+
for (const [key, value] of Object.entries(params)) {
|
|
82
|
+
if (value === void 0) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
url.searchParams.set(key, value === null ? "" : String(value));
|
|
86
|
+
}
|
|
87
|
+
return isAbsolute ? url.toString() : `${url.pathname}${url.search}${url.hash}`;
|
|
88
|
+
}
|
|
89
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
90
|
+
0 && (module.exports = {
|
|
91
|
+
appendAuthRedirectQuery,
|
|
92
|
+
resolveAuthRedirect
|
|
93
|
+
});
|
|
@@ -48,8 +48,27 @@ function buildRedirectPath({ appPublicPath, subAppSegment, target }) {
|
|
|
48
48
|
function getModernClientPrefix() {
|
|
49
49
|
return String(process.env.APP_MODERN_CLIENT_PREFIX || "").trim().replace(/^\/+|\/+$/g, "") || "v";
|
|
50
50
|
}
|
|
51
|
+
function resolveSettingsSigninPrefix(appPublicPath, redirect) {
|
|
52
|
+
if (typeof redirect !== "string") {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
const [pathname] = redirect.split(/[?#]/, 1);
|
|
56
|
+
if (appPublicPath && pathname !== appPublicPath && !pathname.startsWith(`${appPublicPath}/`)) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const pathnameWithinPublicPath = pathname.slice(appPublicPath.length);
|
|
60
|
+
const scopedMatch = pathnameWithinPublicPath.match(/^\/settings\/((?:apps|_app)\/[^/]+)(?:\/|$)/);
|
|
61
|
+
if (scopedMatch) {
|
|
62
|
+
return `${appPublicPath}/settings/${scopedMatch[1]}`;
|
|
63
|
+
}
|
|
64
|
+
return /^\/settings(?:\/|$)/.test(pathnameWithinPublicPath) ? `${appPublicPath}/settings` : null;
|
|
65
|
+
}
|
|
51
66
|
function resolveSigninPrefix({ appPublicPath, redirect, subAppSegment }) {
|
|
52
67
|
const normalizedAppPublicPath = (appPublicPath || "").replace(/\/+$/, "");
|
|
68
|
+
const settingsSigninPrefix = resolveSettingsSigninPrefix(normalizedAppPublicPath, redirect);
|
|
69
|
+
if (settingsSigninPrefix) {
|
|
70
|
+
return settingsSigninPrefix;
|
|
71
|
+
}
|
|
53
72
|
const modernSegment = `/${getModernClientPrefix()}`;
|
|
54
73
|
const modernMarker = `${normalizedAppPublicPath}${modernSegment}`;
|
|
55
74
|
const isModernOrigin = typeof redirect === "string" && (redirect === modernMarker || redirect.startsWith(`${modernMarker}/`));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
/// <reference types="node" />
|
|
10
|
+
import type { IncomingMessage } from 'http';
|
|
11
|
+
/**
|
|
12
|
+
* Resolve the legacy sub-application URL segment for an authentication
|
|
13
|
+
* redirect. A sub-application reached through its custom domain is mounted at
|
|
14
|
+
* the root, while one reached through the supervisor domain uses
|
|
15
|
+
* `/apps/<name>`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveSubAppSegment(req: IncomingMessage, appName?: string | null): Promise<string>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var resolveSubAppSegment_exports = {};
|
|
28
|
+
__export(resolveSubAppSegment_exports, {
|
|
29
|
+
resolveSubAppSegment: () => resolveSubAppSegment
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(resolveSubAppSegment_exports);
|
|
32
|
+
var import_server = require("@nocobase/server");
|
|
33
|
+
function normalizeHostname(value) {
|
|
34
|
+
const host = value == null ? void 0 : value.split(",", 1)[0].trim();
|
|
35
|
+
if (!host) {
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
return new URL(`http://${host}`).hostname;
|
|
40
|
+
} catch {
|
|
41
|
+
return "";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function getRequestHostname(req) {
|
|
45
|
+
const hostnameHeader = req.headers["x-hostname"];
|
|
46
|
+
if (Array.isArray(hostnameHeader)) {
|
|
47
|
+
for (const value of hostnameHeader) {
|
|
48
|
+
const hostname = normalizeHostname(value);
|
|
49
|
+
if (hostname) {
|
|
50
|
+
return hostname;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
const hostname = normalizeHostname(hostnameHeader);
|
|
55
|
+
if (hostname) {
|
|
56
|
+
return hostname;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return (0, import_server.getHostname)(req);
|
|
60
|
+
}
|
|
61
|
+
async function resolveSubAppSegment(req, appName) {
|
|
62
|
+
var _a;
|
|
63
|
+
if (!appName || appName === "main") {
|
|
64
|
+
return "";
|
|
65
|
+
}
|
|
66
|
+
const appSupervisor = import_server.AppSupervisor.getInstance();
|
|
67
|
+
if (!appSupervisor || appSupervisor.runningMode === "single") {
|
|
68
|
+
return "";
|
|
69
|
+
}
|
|
70
|
+
const hostname = getRequestHostname(req);
|
|
71
|
+
if (hostname) {
|
|
72
|
+
const cnameAppName = await ((_a = appSupervisor.getAppNameByCName) == null ? void 0 : _a.call(appSupervisor, hostname));
|
|
73
|
+
if (cnameAppName === appName) {
|
|
74
|
+
return "";
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return `/apps/${appName}`;
|
|
78
|
+
}
|
|
79
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
+
0 && (module.exports = {
|
|
81
|
+
resolveSubAppSegment
|
|
82
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-auth",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.1",
|
|
4
4
|
"main": "./dist/server/index.js",
|
|
5
5
|
"homepage": "https://docs.nocobase.com/handbook/auth",
|
|
6
6
|
"homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/auth",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"description": "User authentication management, including password, SMS, and support for Single Sign-On (SSO) protocols, with extensibility.",
|
|
32
32
|
"description.ru-RU": "Управление аутентификацией пользователей: пароли, SMS, поддержка протоколов единого входа (SSO) и возможность расширения.",
|
|
33
33
|
"description.zh-CN": "用户认证管理,包括基础的密码认证、短信认证、SSO 协议的认证等,可扩展。",
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "22d8be8ece179cfa5c8a4ebb2c896c92bd418e03",
|
|
35
35
|
"keywords": [
|
|
36
36
|
"Authentication",
|
|
37
37
|
"Security"
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
"use strict";(self.webpackChunk_nocobase_plugin_auth_client_v2=self.webpackChunk_nocobase_plugin_auth_client_v2||[]).push([["217"],{264:function(e,t,n){n.r(t),n.d(t,{default:function(){return g}});var r=n(485),a=n(694),l=n(6),i=n(59),o=n(155),u=n.n(o),s=n(442),c=n(488);function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t,n,r,a,l,i){try{var o=e[l](i),u=o.value}catch(e){n(e);return}o.done?t(u):Promise.resolve(u).then(r,a)}function d(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(e,t)}}var p=["$env"];function h(e){var t,n=(0,c.dE)().t,s=(0,c.kj)(),f=(t=(0,a.useFlowContext)(),(0,o.useMemo)(function(){var e,n,r,a,l=null==(r=t.dataSourceManager)||null==(n=r.getCollection)?void 0:n.call(r,"main","users");return(null!=(e=null==l||null==(a=l.getFields)?void 0:a.call(l))?e:[]).filter(function(e){var t,n;return e&&!(null==(t=e.options)?void 0:t.hidden)&&!e.target&&e.interface&&!(null==(n=e.uiSchema)?void 0:n["x-read-pretty"])})},[t])),p=(0,o.useMemo)(function(){var t;return null!=(t=e.value)?t:[]},[e.value]),h=(0,o.useMemo)(function(){var e=new Set(f.map(function(e){return e.name})),t=p.filter(function(t){return e.has(t.field)}),n=new Set(t.map(function(e){return e.field})),r=!0,a=!1,l=void 0;try{for(var i,o=f[Symbol.iterator]();!(r=(i=o.next()).done);r=!0){var u=i.value;n.has(u.name)||t.push({field:u.name,show:"username"===u.name,required:"username"===u.name})}}catch(e){a=!0,l=e}finally{try{r||null==o.return||o.return()}finally{if(a)throw l}}return t},[f,p]);u().useEffect(function(){var t;p.length===h.length&&p.every(function(e,t){return e.field===h[t].field&&!!e.show==!!h[t].show&&!!e.required==!!h[t].required})||null==(t=e.onChange)||t.call(e,h)},[h]);var y=(0,l.useMemoizedFn)(function(t,n){var r,a=h.map(function(e){if(e.field!==t)return e;var r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e,n);return r.required&&(r.show=!0),r.show||(r.required=!1),r});null==(r=e.onChange)||r.call(e,a)}),b=(0,l.useMemoizedFn)(function(e){var t,n,r=f.find(function(t){return t.name===e});return s((null==r||null==(t=r.uiSchema)?void 0:t.title)||(null==r||null==(n=r.options)?void 0:n.title)||e)}),g=(0,o.useMemo)(function(){return[{title:n("Field"),dataIndex:"field",width:200,render:function(e){return u().createElement(i.Tag,null,b(e))}},{title:n("Show"),dataIndex:"show",width:80,align:"center",render:function(e,t){return u().createElement(i.Checkbox,{checked:!!t.show,onChange:function(e){return y(t.field,{show:e.target.checked})}})}},{title:n("Required"),dataIndex:"required",width:80,align:"center",render:function(e,t){return u().createElement(i.Checkbox,{checked:!!t.required,onChange:function(e){return y(t.field,{required:e.target.checked})}})}},{title:"",dataIndex:"_filler",render:function(){return null}}]},[b,n,y]),v=(0,l.useMemoizedFn)(function(t,n){var r,a=h.findIndex(function(e){return e.field===t.field}),l=h.findIndex(function(e){return e.field===n.field});if(!(a<0)&&!(l<0)&&a!==l){var i,o=function(e){if(Array.isArray(e))return m(e)}(h)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(h)||d(h)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),u=(function(e){if(Array.isArray(e))return e}(i=o.splice(a,1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],l=!0,i=!1;try{for(r=r.call(e);!(l=(t=r.next()).done)&&(a.push(t.value),1!==a.length);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==r.return||r.return()}finally{if(i)throw n}}return a}}(i)||d(i,1)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];o.splice(l,0,u),null==(r=e.onChange)||r.call(e,o)}});return u().createElement(r.Table,{rowKey:"field",pagination:!1,columns:g,dataSource:h,isDraggable:!0,onSortEnd:v,sortHandleColumnWidth:32,showIndex:!1})}function y(){var e=(0,c.dE)().t;return u().createElement(u().Fragment,null,u().createElement(i.Form.Item,{name:["options","public","allowSignUp"],label:e("Allow to sign up"),valuePropName:"checked",initialValue:!0},u().createElement(i.Checkbox,null)),u().createElement(i.Form.Item,{label:e("Sign up form"),name:["options","public","signupForm"],validateFirst:!0},u().createElement(h,null)))}function b(){var e,t,n,m=(0,c.dE)().t,d=i.Form.useFormInstance(),h=i.Form.useWatch(["options","public","enableResetPassword"],d),y=i.Form.useWatch(["options","emailContentType"],d)||"html",b=(e=(0,c.dE)().t,(0,o.useMemo)(function(){return[{name:"$user",title:e("Current user"),type:"object",paths:["$user"],children:[{name:"username",title:e("Username"),type:"string",paths:["$user","username"]},{name:"nickname",title:e("Nickname"),type:"string",paths:["$user","nickname"]},{name:"email",title:e("Email"),type:"string",paths:["$user","email"]}]},{name:"$systemSettings",title:e("System settings"),type:"object",paths:["$systemSettings"],children:[{name:"title",title:e("System title"),type:"string",paths:["$systemSettings","title"]},{name:"logo",title:e("System logo"),type:"string",paths:["$systemSettings","logo"]}]},{name:"$resetLink",title:e("Reset password link"),type:"string",paths:["$resetLink"]},{name:"$resetLinkExpiration",title:e("Reset link expiration (minutes)"),type:"string",paths:["$resetLinkExpiration"]}]},[e])),g=(t=!!h,n=(0,a.useFlowContext)(),(0,l.useRequest)(function(){var e;return(e=function(){var e,t,r,a;return function(e,t){var n,r,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),o=Object.defineProperty;return o(i,"next",{value:u(0)}),o(i,"throw",{value:u(1)}),o(i,"return",{value:u(2)}),"function"==typeof Symbol&&o(i,Symbol.iterator,{value:function(){return this}}),i;function u(o){return function(u){var s=[o,u];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(l=0)),l;)try{if(n=1,r&&(a=2&s[0]?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return l.label++,{value:s[1],done:!1};case 5:l.label++,r=s[1],s=[0];continue;case 7:s=l.ops.pop(),l.trys.pop();continue;default:if(!(a=(a=l.trys).length>0&&a[a.length-1])&&(6===s[0]||2===s[0])){l=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){l.label=s[1];break}if(6===s[0]&&l.label<a[1]){l.label=a[1],a=s;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(s);break}a[2]&&l.ops.pop(),l.trys.pop();continue}s=t.call(e,l)}catch(e){s=[6,e],r=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:return[4,n.api.resource("notificationChannels").list({filter:{notificationType:"email"},pageSize:50})];case 1:return[2,Array.isArray(a=null!=(e=null==(r=l.sent())||null==(t=r.data)?void 0:t.data)?e:null==r?void 0:r.data)?a:[]]}})},function(){var t=this,n=arguments;return new Promise(function(r,a){var l=e.apply(t,n);function i(e){f(l,r,a,i,o,"next",e)}function o(e){f(l,r,a,i,o,"throw",e)}i(void 0)})})()},{ready:t,cacheKey:"@nocobase/plugin-auth:notificationChannels:email",refreshDeps:[t]})),v=g.data,E=g.loading,w=(0,o.useMemo)(function(){return(v||[]).map(function(e){return{label:e.title,value:e.name}})},[v]);return u().createElement(u().Fragment,null,u().createElement(i.Form.Item,{name:["options","public","enableResetPassword"],label:m("Enable forget password"),valuePropName:"checked",initialValue:!1},u().createElement(i.Checkbox,null)),h?u().createElement(u().Fragment,null,u().createElement(i.Typography.Title,{level:5,style:{marginTop:0}},m("1. Select notification channel")),u().createElement(i.Form.Item,{name:["options","notificationChannel"],label:m("Notification channel (Email)"),extra:m("The notification channel used to send the reset password email, only support email channel"),rules:[{required:!0,message:m("Please select a notification channel")}]},u().createElement(i.Select,{loading:E,options:w,placeholder:m("Select"),notFoundContent:u().createElement("span",null,m("No notification channels found. Please "),u().createElement(s.Link,{to:"/admin/settings/notification-manager/channels"},m("add one first")),".")})),u().createElement(i.Typography.Title,{level:5},m("2. Configure reset email")),u().createElement(i.Form.Item,{name:["options","emailSubject"],label:m("Subject"),rules:[{required:!0,message:m("Please enter the email subject")}],initialValue:m("defaultResetPasswordEmailSubject")},u().createElement(r.VariableInput,{namespaces:p,extraNodes:b})),u().createElement(i.Form.Item,{name:["options","emailContentType"],label:m("Content type"),initialValue:"html",rules:[{required:!0}]},u().createElement(i.Radio.Group,{options:[{label:"HTML",value:"html"},{label:m("Plain text"),value:"text"}]})),"html"===y?u().createElement(i.Form.Item,{key:"html",name:["options","emailContentHTML"],label:m("Content"),rules:[{required:!0,message:m("Please enter the email content")}],initialValue:m("defaultResetPasswordEmailContentHTML")},u().createElement(r.VariableTextArea,{namespaces:p,extraNodes:b,placeholder:"Hi,",rows:10})):u().createElement(i.Form.Item,{key:"text",name:["options","emailContentText"],label:m("Content"),rules:[{required:!0,message:m("Please enter the email content")}],initialValue:m("defaultResetPasswordEmailContentText")},u().createElement(r.VariableTextArea,{namespaces:p,extraNodes:b,rows:10})),u().createElement(i.Form.Item,{name:["options","resetTokenExpiresIn"],label:m("Reset link expiration"),initialValue:120,rules:[{required:!0,message:m("Please enter the expiration in minutes")}]},u().createElement(i.InputNumber,{min:1,addonAfter:m("Minutes"),style:{width:"100%"}}))):null)}function g(){var e=(0,c.dE)().t;return u().createElement("div",null,u().createElement(i.Alert,{style:{marginBottom:16},type:"info",showIcon:!0,message:e("The authentication allows users to sign in via username or email.")}),u().createElement(i.Tabs,{items:[{key:"signup",label:e("Sign up settings"),forceRender:!0,children:u().createElement(y,null)},{key:"forgot",label:e("Forgot password"),forceRender:!0,children:u().createElement(b,null)}]}))}}}]);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
"use strict";(self.webpackChunk_nocobase_plugin_auth_client_v2=self.webpackChunk_nocobase_plugin_auth_client_v2||[]).push([["795"],{918:function(e,t,r){r.r(t),r.d(t,{default:function(){return f}});var n=r(59),a=r(155),o=r.n(a),l=r(442),u=r(488),i=r(824);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t,r,n,a,o,l){try{var u=e[o](l),i=u.value}catch(e){r(e);return}u.done?t(i):Promise.resolve(i).then(n,a)}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],l=!0,u=!1;try{for(a=a.call(e);!(l=(r=a.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{l||null==a.return||a.return()}finally{if(u)throw n}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e){var t,r,s=e.authenticator,f=(0,u.dE)().t,p=m(n.Form.useForm(),1)[0],y=m((0,a.useState)(""),2),d=y[0],v=y[1],h=m((0,a.useState)(!1),2),b=h[0],g=h[1],w=(0,i.go)(s.name),E=!!(null==s||null==(t=s.options)?void 0:t.allowSignUp),P=!!(null==s||null==(r=s.options)?void 0:r.enableResetPassword);return o().createElement(n.Form,{form:p,layout:"vertical",onFinish:function(e){var t;return(t=function(){var t,r,n,a,o;return function(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:i(0)}),u(l,"throw",{value:i(1)}),u(l,"return",{value:i(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function i(u){return function(i){var s=[u,i];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,s[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&s[0]?n.return:s[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,s[1])).done)return a;switch(n=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){o.label=s[1];break}if(6===s[0]&&o.label<a[1]){o.label=a[1],a=s;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(s);break}a[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:v(""),g(!0),l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,w.run(e)];case 2:return l.sent(),[3,5];case 3:return v((null==(t=l.sent())||null==(o=t.response)||null==(a=o.data)||null==(n=a.errors)||null==(r=n[0])?void 0:r.message)||(null==t?void 0:t.message)||String(t)),[3,5];case 4:return g(!1),[7];case 5:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,a){var o=t.apply(e,r);function l(e){c(o,n,a,l,u,"next",e)}function u(e){c(o,n,a,l,u,"throw",e)}l(void 0)})})()}},d?o().createElement(n.Alert,{style:{marginBottom:16},type:"error",showIcon:!0,message:d}):null,o().createElement(n.Form.Item,{name:"account",rules:[{required:!0,message:f("Please enter your username or email")},{validator:function(e,t){return t?String(t).includes("@")?/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(String(t))?Promise.resolve():Promise.reject(Error(f("Please enter a valid email"))):/^[^@<>"'/]{1,50}$/.test(String(t))?Promise.resolve():Promise.reject(Error(f("Please enter a valid username"))):Promise.resolve()}}]},o().createElement(n.Input,{autoComplete:"username",placeholder:f("Username/Email")})),o().createElement(n.Form.Item,{name:"password",rules:[{required:!0,message:f("Please enter a password")}]},o().createElement(n.Input.Password,{autoComplete:"current-password",placeholder:f("Password")})),o().createElement(n.Form.Item,{style:{marginBottom:12}},o().createElement(n.Button,{loading:b,htmlType:"submit",type:"primary",block:!0},f("Sign in"))),o().createElement("div",{style:{display:"flex",justifyContent:"space-between",gap:12}},E?o().createElement(l.Link,{to:"/signup?name=".concat(s.name)},f("Create an account")):null,P?o().createElement(l.Link,{to:"/forgot-password?name=".concat(s.name)},f("Forgot password")):null))}}}]);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
"use strict";(self.webpackChunk_nocobase_plugin_auth_client_v2=self.webpackChunk_nocobase_plugin_auth_client_v2||[]).push([["841"],{720:function(e,t,r){r.r(t),r.d(t,{default:function(){return h}});var n=r(59),a=r(155),l=r.n(a),o=r(442),u=r(230),i=r(953),s=r(485),c=r(488),m=r(295);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t,r,n,a,l,o){try{var u=e[l](o),i=u.value}catch(e){r(e);return}u.done?t(i):Promise.resolve(i).then(n,a)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var l=[],o=!0,u=!1;try{for(a=a.call(e);!(o=(r=a.next()).done)&&(l.push(r.value),!t||l.length!==t);o=!0);}catch(e){u=!0,n=e}finally{try{o||null==a.return||a.return()}finally{if(u)throw n}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return p(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){var t,r=e.authenticatorName,p=(0,s.useApp)(),h=(0,o.useNavigate)(),v=(0,c.dE)().t,y=(0,i.useTranslation)("lm-collections").t,b=(0,m.p)(r),g=d(n.Form.useForm(),1)[0],w=d((0,a.useState)(!1),2),E=w[0],S=w[1],k=d((0,a.useState)(""),2),I=k[0],x=k[1],P=(0,a.useMemo)(function(){var e;return((null==b||null==(e=b.options)?void 0:e.signupForm)||[]).filter(function(e){return null==e?void 0:e.show})},[b]);return(null==b||null==(t=b.options)?void 0:t.allowSignUp)?l().createElement(n.Form,{form:g,layout:"vertical",onFinish:function(e){var t;return(t=function(){var t,a,l,o,u;return function(e,t){var r,n,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(o,"next",{value:i(0)}),u(o,"throw",{value:i(1)}),u(o,"return",{value:i(2)}),"function"==typeof Symbol&&u(o,Symbol.iterator,{value:function(){return this}}),o;function i(u){return function(i){var s=[u,i];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(l=0)),l;)try{if(r=1,n&&(a=2&s[0]?n.return:s[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,s[1])).done)return a;switch(n=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return l.label++,{value:s[1],done:!1};case 5:l.label++,n=s[1],s=[0];continue;case 7:s=l.ops.pop(),l.trys.pop();continue;default:if(!(a=(a=l.trys).length>0&&a[a.length-1])&&(6===s[0]||2===s[0])){l=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){l.label=s[1];break}if(6===s[0]&&l.label<a[1]){l.label=a[1],a=s;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(s);break}a[2]&&l.ops.pop(),l.trys.pop();continue}s=t.call(e,l)}catch(e){s=[6,e],n=0}finally{r=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}(this,function(i){switch(i.label){case 0:x(""),S(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,p.apiClient.auth.signUp(e,r)];case 2:return i.sent(),n.message.success(v("Sign up successfully, and automatically jump to the sign in page")),window.setTimeout(function(){h("/signin",{replace:!0})},2e3),[3,5];case 3:return x((null==(t=i.sent())||null==(u=t.response)||null==(o=u.data)||null==(l=o.errors)||null==(a=l[0])?void 0:a.message)||(null==t?void 0:t.message)||String(t)),[3,5];case 4:return S(!1),[7];case 5:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,a){var l=t.apply(e,r);function o(e){f(l,n,a,o,u,"next",e)}function u(e){f(l,n,a,o,u,"throw",e)}o(void 0)})})()}},I?l().createElement(n.Alert,{style:{marginBottom:16},type:"error",showIcon:!0,message:I}):null,P.map(function(e){var t,r,a,o,i,s;return a=(r=(null==e?void 0:e.uiSchema)||{})["x-component"],o=r.title?y(u.Schema.compile(r.title,{t:v})):e.field,i=[],e.required&&i.push({required:!0,message:v("Please enter ".concat(e.field))}),"email"===e.field&&i.push({type:"email",message:v("Please enter a valid email address")}),s=l().createElement(n.Input,null),(null==(t=r.enum)?void 0:t.length)?s=l().createElement(n.Select,{options:r.enum.map(function(e){return{label:e.label||e.value,value:e.value}})}):"Checkbox"===a?s=l().createElement(n.Checkbox,null):("Input.TextArea"===a||"TextArea"===a)&&(s=l().createElement(n.Input.TextArea,{rows:4})),l().createElement(n.Form.Item,{key:e.field,name:e.field,label:o,valuePropName:"Checkbox"===a?"checked":"value",rules:i},s)}),l().createElement(n.Form.Item,{label:v("Password"),name:"password",rules:[{required:!0,message:v("Please enter a password")}]},l().createElement(n.Input.Password,{autoComplete:"new-password"})),l().createElement(n.Form.Item,{label:v("Confirm password"),name:"confirm_password",dependencies:["password"],rules:[{required:!0,message:v("Please enter the same password again")},function(e){var t=e.getFieldValue;return{validator:function(e,r){return r&&t("password")!==r?Promise.reject(Error(v("The passwords entered twice are inconsistent"))):Promise.resolve()}}}]},l().createElement(n.Input.Password,{autoComplete:"new-password"})),l().createElement(n.Form.Item,{style:{marginBottom:12}},l().createElement(n.Button,{loading:E,htmlType:"submit",type:"primary",block:!0},v("Sign up"))),l().createElement(o.Link,{to:"/signin"},v("Log in with an existing account"))):l().createElement(o.Navigate,{to:"/not-found",replace:!0})}}}]);
|