@lobehub/lobehub 2.1.2 → 2.1.3

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 (49) hide show
  1. package/.env.example +4 -3
  2. package/.github/workflows/release-desktop-stable.yml +1 -1
  3. package/CHANGELOG.md +25 -0
  4. package/Dockerfile +6 -4
  5. package/README.md +2 -3
  6. package/README.zh-CN.md +2 -3
  7. package/changelog/v2.json +5 -0
  8. package/docs/self-hosting/auth/providers/password.mdx +112 -0
  9. package/docs/self-hosting/auth/providers/password.zh-CN.mdx +103 -0
  10. package/docs/self-hosting/auth.mdx +12 -0
  11. package/docs/self-hosting/auth.zh-CN.mdx +12 -0
  12. package/docs/self-hosting/environment-variables/auth.mdx +7 -0
  13. package/docs/self-hosting/environment-variables/auth.zh-CN.mdx +7 -0
  14. package/docs/self-hosting/environment-variables/basic.mdx +0 -7
  15. package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +0 -7
  16. package/docs/self-hosting/examples/azure-openai.mdx +0 -1
  17. package/docs/self-hosting/examples/azure-openai.zh-CN.mdx +0 -1
  18. package/locales/en-US/auth.json +1 -0
  19. package/locales/zh-CN/auth.json +1 -0
  20. package/netlify.toml +0 -1
  21. package/package.json +1 -1
  22. package/packages/types/src/serverConfig.ts +1 -0
  23. package/src/app/[variants]/(auth)/signin/SignInEmailStep.tsx +56 -49
  24. package/src/app/[variants]/(auth)/signin/page.tsx +2 -0
  25. package/src/app/[variants]/(auth)/signin/useSignIn.ts +2 -0
  26. package/src/app/[variants]/(auth)/signup/[[...signup]]/page.tsx +7 -0
  27. package/src/envs/app.ts +0 -2
  28. package/src/envs/auth.ts +3 -0
  29. package/src/libs/better-auth/define-config.ts +1 -1
  30. package/src/libs/next/proxy/define-config.ts +0 -1
  31. package/src/locales/default/auth.ts +2 -0
  32. package/src/server/globalConfig/index.ts +1 -0
  33. package/src/store/chat/slices/topic/action.ts +1 -1
  34. package/src/store/electron/actions/settings.ts +7 -7
  35. package/src/store/electron/actions/sync.ts +11 -11
  36. package/src/store/global/actions/general.ts +12 -12
  37. package/src/store/global/initialState.ts +11 -11
  38. package/src/store/global/selectors/clientDB.ts +1 -1
  39. package/src/store/global/selectors/systemStatus.ts +1 -1
  40. package/src/store/image/slices/generationConfig/action.ts +12 -12
  41. package/src/store/image/utils/size.ts +11 -11
  42. package/src/store/library/slices/ragEval/actions/dataset.ts +1 -1
  43. package/src/store/serverConfig/selectors.ts +1 -0
  44. package/src/store/session/slices/session/initialState.ts +6 -6
  45. package/src/store/session/slices/session/reducers.ts +1 -1
  46. package/src/store/session/slices/sessionGroup/initialState.ts +2 -2
  47. package/src/store/tool/slices/customPlugin/action.ts +2 -2
  48. package/src/store/tool/slices/oldStore/action.ts +5 -5
  49. package/src/store/userMemory/slices/preference/action.ts +6 -6
package/.env.example CHANGED
@@ -1,6 +1,3 @@
1
- # add a access code to lock your lobe-chat application, you can set a long password to avoid leaking. If this value contains a comma, it is a password array.
2
- # ACCESS_CODE=lobe66
3
-
4
1
  # Specify your API Key selection method, currently supporting `random` and `turn`.
5
2
  # API_KEY_SELECT_MODE=random
6
3
 
@@ -295,6 +292,10 @@ OPENAI_API_KEY=sk-xxxxxxxxx
295
292
  # Leave empty to allow all emails
296
293
  # AUTH_ALLOWED_EMAILS=example.com,admin@other.com
297
294
 
295
+ # Disable email/password authentication (SSO-only mode)
296
+ # Set to '1' to disable email/password sign-in and registration, only allowing SSO login
297
+ # AUTH_DISABLE_EMAIL_PASSWORD=0
298
+
298
299
  # Google OAuth Configuration (for Better-Auth)
299
300
  # Get credentials from: https://console.cloud.google.com/apis/credentials
300
301
  # Authorized redirect URIs:
@@ -148,7 +148,7 @@ jobs:
148
148
  # 使用 GitHub Hosted Runner
149
149
  if [[ "${{ github.event_name }}" != "workflow_dispatch" ]] || [[ "${{ inputs.build_mac }}" == "true" ]]; then
150
150
  echo "Using GitHub-Hosted Runner for macOS ARM64"
151
- arm_entry='{"os": "macos-14", "name": "macos-arm64"}'
151
+ arm_entry='{"os": "macos-15", "name": "macos-arm64"}'
152
152
  static_matrix=$(echo "$static_matrix" | jq -c --argjson entry "$arm_entry" '. + [$entry]')
153
153
  fi
154
154
 
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 2.1.3](https://github.com/lobehub/lobe-chat/compare/v2.1.2...v2.1.3)
6
+
7
+ <sup>Released on **2026-01-31**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **auth**: Add AUTH_DISABLE_EMAIL_PASSWORD env to enable SSO-only mode.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **auth**: Add AUTH_DISABLE_EMAIL_PASSWORD env to enable SSO-only mode, closes [#12009](https://github.com/lobehub/lobe-chat/issues/12009) ([f3210a3](https://github.com/lobehub/lobe-chat/commit/f3210a3))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
5
30
  ### [Version 2.1.2](https://github.com/lobehub/lobe-chat/compare/v2.1.1...v2.1.2)
6
31
 
7
32
  <sup>Released on **2026-01-30**</sup>
package/Dockerfile CHANGED
@@ -158,14 +158,12 @@ ENV HOSTNAME="0.0.0.0" \
158
158
  PORT="3210"
159
159
 
160
160
  # General Variables
161
- ENV ACCESS_CODE="" \
162
- APP_URL="" \
161
+ ENV APP_URL="" \
163
162
  API_KEY_SELECT_MODE="" \
164
163
  DEFAULT_AGENT_CONFIG="" \
165
164
  SYSTEM_AGENT="" \
166
165
  FEATURE_FLAGS="" \
167
- PROXY_URL="" \
168
- ENABLE_AUTH_PROTECTION=""
166
+ PROXY_URL=""
169
167
 
170
168
  # Database
171
169
  ENV KEY_VAULTS_SECRET="" \
@@ -176,6 +174,10 @@ ENV KEY_VAULTS_SECRET="" \
176
174
  ENV AUTH_SECRET="" \
177
175
  AUTH_SSO_PROVIDERS="" \
178
176
  AUTH_ALLOWED_EMAILS="" \
177
+ AUTH_TRUSTED_ORIGINS="" \
178
+ AUTH_DISABLE_EMAIL_PASSWORD="" \
179
+ AUTH_EMAIL_VERIFICATION="" \
180
+ AUTH_ENABLE_MAGIC_LINK="" \
179
181
  # Google
180
182
  AUTH_GOOGLE_ID="" \
181
183
  AUTH_GOOGLE_SECRET="" \
package/README.md CHANGED
@@ -581,7 +581,7 @@ LobeHub provides Self-Hosted Version with Vercel, Alibaba Cloud, and [Docker Ima
581
581
  "If you want to deploy this service yourself on Vercel, Zeabur or Alibaba Cloud, you can follow these steps:
582
582
 
583
583
  - Prepare your [OpenAI API Key](https://platform.openai.com/account/api-keys).
584
- - Click the button below to start deployment: Log in directly with your GitHub account, and remember to fill in the `OPENAI_API_KEY`(required) and `ACCESS_CODE` (recommended) on the environment variable section.
584
+ - Click the button below to start deployment: Log in directly with your GitHub account, and remember to fill in the `OPENAI_API_KEY`(required) on the environment variable section.
585
585
  - After deployment, you can start using it.
586
586
  - Bind a custom domain (optional): The DNS of the domain assigned by Vercel is polluted in some areas; binding a custom domain can connect directly.
587
587
 
@@ -647,7 +647,6 @@ This project provides some additional configuration items set with environment v
647
647
  | -------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
648
648
  | `OPENAI_API_KEY` | Yes | This is the API key you apply on the OpenAI account page | `sk-xxxxxx...xxxxxx` |
649
649
  | `OPENAI_PROXY_URL` | No | If you manually configure the OpenAI interface proxy, you can use this configuration item to override the default OpenAI API request base URL | `https://api.chatanywhere.cn` or `https://aihubmix.com/v1` <br/>The default value is<br/>`https://api.openai.com/v1` |
650
- | `ACCESS_CODE` | No | Add a password to access this service; you can set a long password to avoid leaking. If this value contains a comma, it is a password array. | `awCTe)re_r74` or `rtrt_ewee3@09!` or `code1,code2,code3` |
651
650
  | `OPENAI_MODEL_LIST` | No | Used to control the model list. Use `+` to add a model, `-` to hide a model, and `model_name=display_name` to customize the display name of a model, separated by commas. | `qwen-7b-chat,+glm-6b,-gpt-3.5-turbo` |
652
651
 
653
652
  > \[!NOTE]
@@ -829,7 +828,7 @@ This project is [LobeHub Community License](./LICENSE) licensed.
829
828
  [codespaces-link]: https://codespaces.new/lobehub/lobe-chat
830
829
  [codespaces-shield]: https://github.com/codespaces/badge.svg
831
830
  [deploy-button-image]: https://vercel.com/button
832
- [deploy-link]: https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Flobehub%2Flobe-chat&env=OPENAI_API_KEY,ACCESS_CODE&envDescription=Find%20your%20OpenAI%20API%20Key%20by%20click%20the%20right%20Learn%20More%20button.%20%7C%20Access%20Code%20can%20protect%20your%20website&envLink=https%3A%2F%2Fplatform.openai.com%2Faccount%2Fapi-keys&project-name=lobe-chat&repository-name=lobe-chat
831
+ [deploy-link]: https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Flobehub%2Flobe-chat&env=OPENAI_API_KEY&envDescription=Find%20your%20OpenAI%20API%20Key%20by%20click%20the%20right%20Learn%20More%20button.&envLink=https%3A%2F%2Fplatform.openai.com%2Faccount%2Fapi-keys&project-name=lobe-chat&repository-name=lobe-chat
833
832
  [deploy-on-alibaba-cloud-button-image]: https://service-info-public.oss-cn-hangzhou.aliyuncs.com/computenest-en.svg
834
833
  [deploy-on-alibaba-cloud-link]: https://computenest.console.aliyun.com/service/instance/create/default?type=user&ServiceName=LobeHub%E7%A4%BE%E5%8C%BA%E7%89%88
835
834
  [deploy-on-repocloud-button-image]: https://d16t0pc4846x52.cloudfront.net/deploylobe.svg
package/README.zh-CN.md CHANGED
@@ -555,7 +555,7 @@ LobeHub 提供了 Vercel 的 自托管版本 和 [Docker 镜像][docker-release-
555
555
  如果想在 Vercel 、 Zeabur 或 阿里云 上部署该服务,可以按照以下步骤进行操作:
556
556
 
557
557
  - 准备好你的 [OpenAI API Key](https://platform.openai.com/account/api-keys) 。
558
- - 点击下方按钮开始部署: 直接使用 GitHub 账号登录即可,记得在环境变量页填入 `OPENAI_API_KEY` (必填) and `ACCESS_CODE`(推荐);
558
+ - 点击下方按钮开始部署: 直接使用 GitHub 账号登录即可,记得在环境变量页填入 `OPENAI_API_KEY` (必填);
559
559
  - 部署完毕后,即可开始使用;
560
560
  - 绑定自定义域名(可选):Vercel 分配的域名 DNS 在某些区域被污染了,绑定自定义域名即可直连。目前 Zeabur 提供的域名还未被污染,大多数地区都可以直连。
561
561
 
@@ -621,7 +621,6 @@ docker compose up -d
621
621
  | ------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
622
622
  | `OPENAI_API_KEY` | 必选 | 这是你在 OpenAI 账户页面申请的 API 密钥 | `sk-xxxxxx...xxxxxx` |
623
623
  | `OPENAI_PROXY_URL` | 可选 | 如果你手动配置了 OpenAI 接口代理,可以使用此配置项来覆盖默认的 OpenAI API 请求基础 URL | `https://api.chatanywhere.cn` 或 `https://aihubmix.com/v1`<br/>默认值:<br/>`https://api.openai.com/v1` |
624
- | `ACCESS_CODE` | 可选 | 添加访问此服务的密码,你可以设置一个长密码以防被爆破,该值用逗号分隔时为密码数组 | `awCTe)re_r74` or `rtrt_ewee3@09!` or `code1,code2,code3` |
625
624
  | `OPENAI_MODEL_LIST` | 可选 | 用来控制模型列表,使用 `+` 增加一个模型,使用 `-` 来隐藏一个模型,使用 `模型名=展示名` 来自定义模型的展示名,用英文逗号隔开。 | `qwen-7b-chat,+glm-6b,-gpt-3.5-turbo` |
626
625
 
627
626
  > \[!NOTE]
@@ -843,7 +842,7 @@ This project is [LobeHub Community License](./LICENSE) licensed.
843
842
  [codespaces-link]: https://codespaces.new/lobehub/lobe-chat
844
843
  [codespaces-shield]: https://github.com/codespaces/badge.svg
845
844
  [deploy-button-image]: https://vercel.com/button
846
- [deploy-link]: https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Flobehub%2Flobe-chat&env=OPENAI_API_KEY,ACCESS_CODE&envDescription=Find%20your%20OpenAI%20API%20Key%20by%20click%20the%20right%20Learn%20More%20button.%20%7C%20Access%20Code%20can%20protect%20your%20website&envLink=https%3A%2F%2Fplatform.openai.com%2Faccount%2Fapi-keys&project-name=lobe-chat&repository-name=lobe-chat
845
+ [deploy-link]: https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Flobehub%2Flobe-chat&env=OPENAI_API_KEY&envDescription=Find%20your%20OpenAI%20API%20Key%20by%20click%20the%20right%20Learn%20More%20button.&envLink=https%3A%2F%2Fplatform.openai.com%2Faccount%2Fapi-keys&project-name=lobe-chat&repository-name=lobe-chat
847
846
  [deploy-on-alibaba-cloud-button-image]: https://service-info-public.oss-cn-hangzhou.aliyuncs.com/computenest-en.svg
848
847
  [deploy-on-alibaba-cloud-link]: https://computenest.console.aliyun.com/service/instance/create/default?type=user&ServiceName=LobeHub%E7%A4%BE%E5%8C%BA%E7%89%88
849
848
  [deploy-on-sealos-button-image]: https://raw.githubusercontent.com/labring-actions/templates/main/Deploy-on-Sealos.svg
package/changelog/v2.json CHANGED
@@ -1,4 +1,9 @@
1
1
  [
2
+ {
3
+ "children": {},
4
+ "date": "2026-01-31",
5
+ "version": "2.1.3"
6
+ },
2
7
  {
3
8
  "children": {
4
9
  "fixes": [
@@ -0,0 +1,112 @@
1
+ ---
2
+ title: Configuring Email/Password Authentication for LobeHub
3
+ description: >-
4
+ Learn how to configure email and password authentication for LobeHub,
5
+ including enabling/disabling options and SSO-only mode.
6
+ tags:
7
+ - Email
8
+ - Password
9
+ - Authentication
10
+ - LobeHub
11
+ ---
12
+
13
+ # Configuring Email/Password Authentication
14
+
15
+ LobeHub supports traditional email and password authentication out of the box.
16
+ This guide covers the available configuration options.
17
+
18
+ ## Default Behavior
19
+
20
+ By default, email/password authentication is enabled.
21
+ Users can register with their email address and set a password.
22
+
23
+ ## Configuration Options
24
+
25
+ ### Disable Email/Password Authentication (SSO-Only Mode)
26
+
27
+ If you want to force users to authenticate via SSO providers only,
28
+ set the following environment variable:
29
+
30
+ | Environment Variable | Type | Description |
31
+ | ----------------------------- | -------- | ------------------------------------------ |
32
+ | `AUTH_DISABLE_EMAIL_PASSWORD` | Optional | Set to `1` to disable email/password login |
33
+
34
+ When enabled:
35
+
36
+ - The email input field is hidden on the login page
37
+ - Only SSO provider buttons are displayed
38
+ - The signup page redirects to the login page
39
+ - Users must authenticate through configured SSO providers
40
+
41
+ <Callout type={'warning'}>
42
+ Before enabling SSO-only mode, ensure you have configured at least one SSO
43
+ provider via `AUTH_SSO_PROVIDERS`. Otherwise, users will have no way to log
44
+ in.
45
+ </Callout>
46
+
47
+ ### Enable Email Verification
48
+
49
+ To require users to verify their email address before signing in:
50
+
51
+ | Environment Variable | Type | Description |
52
+ | ------------------------- | -------- | ---------------------------------------- |
53
+ | `AUTH_EMAIL_VERIFICATION` | Optional | Set to `1` to require email verification |
54
+
55
+ This requires configuring an email service (SMTP).
56
+ See [Email Service Configuration](/docs/self-hosting/auth/email) for details.
57
+
58
+ ### Enable Magic Link Login
59
+
60
+ To allow passwordless login via email magic links:
61
+
62
+ | Environment Variable | Type | Description |
63
+ | ------------------------ | -------- | ------------------------------------- |
64
+ | `AUTH_ENABLE_MAGIC_LINK` | Optional | Set to `1` to enable magic link login |
65
+
66
+ This also requires configuring an email service (SMTP).
67
+
68
+ ## Change Password
69
+
70
+ Users can change their password in two ways:
71
+
72
+ 1. **Profile Settings**: Go to Settings > Profile to change password
73
+ 2. **Forgot Password**: On the login page, enter email, proceed to the password step, then click "Forgot Password" below the password input
74
+
75
+ <Callout type={'info'}>
76
+ Both methods require email service (SMTP) to be configured for sending
77
+ password reset emails.
78
+ </Callout>
79
+
80
+ ## Example Configurations
81
+
82
+ ### SSO-Only (Disable Email/Password)
83
+
84
+ ```bash
85
+ AUTH_DISABLE_EMAIL_PASSWORD=1
86
+ AUTH_SSO_PROVIDERS=google,github
87
+ ```
88
+
89
+ ### Email/Password with Verification
90
+
91
+ ```bash
92
+ AUTH_EMAIL_VERIFICATION=1
93
+ SMTP_HOST=smtp.example.com
94
+ SMTP_PORT=587
95
+ SMTP_USER=noreply@example.com
96
+ SMTP_PASS=your-password
97
+ ```
98
+
99
+ ### Email/Password with Magic Link
100
+
101
+ ```bash
102
+ AUTH_ENABLE_MAGIC_LINK=1
103
+ SMTP_HOST=smtp.example.com
104
+ SMTP_PORT=587
105
+ SMTP_USER=noreply@example.com
106
+ SMTP_PASS=your-password
107
+ ```
108
+
109
+ <Callout type={'tip'}>
110
+ Go to [Environment Variables](/docs/self-hosting/environment-variables/auth)
111
+ for detailed information on all authentication variables.
112
+ </Callout>
@@ -0,0 +1,103 @@
1
+ ---
2
+ title: 配置 LobeHub 邮箱密码登录
3
+ description: 了解如何配置 LobeHub 的邮箱密码登录,包括启用/禁用选项和仅 SSO 模式。
4
+ tags:
5
+ - 邮箱
6
+ - 密码
7
+ - 身份验证
8
+ - LobeHub
9
+ ---
10
+
11
+ # 配置邮箱密码登录
12
+
13
+ LobeHub 默认支持传统的邮箱密码登录方式。本指南介绍可用的配置选项。
14
+
15
+ ## 默认行为
16
+
17
+ 默认情况下,邮箱密码登录已启用。用户可以使用邮箱地址注册并设置密码。
18
+
19
+ ## 配置选项
20
+
21
+ ### 禁用邮箱密码登录(仅 SSO 模式)
22
+
23
+ 如果你希望强制用户只能通过 SSO 提供商登录,请设置以下环境变量:
24
+
25
+ | 环境变量 | 类型 | 描述 |
26
+ | ----------------------------- | -- | ---------------- |
27
+ | `AUTH_DISABLE_EMAIL_PASSWORD` | 可选 | 设置为 `1` 禁用邮箱密码登录 |
28
+
29
+ 启用后:
30
+
31
+ - 登录页面隐藏邮箱输入框
32
+ - 仅显示 SSO 提供商登录按钮
33
+ - 注册页面重定向到登录页面
34
+ - 用户必须通过配置的 SSO 提供商进行身份验证
35
+
36
+ <Callout type={'warning'}>
37
+ 启用仅 SSO 模式前,请确保已通过 `AUTH_SSO_PROVIDERS` 配置了至少一个 SSO
38
+ 提供商。否则用户将无法登录。
39
+ </Callout>
40
+
41
+ ### 启用邮箱验证
42
+
43
+ 要求用户在登录前验证邮箱地址:
44
+
45
+ | 环境变量 | 类型 | 描述 |
46
+ | ------------------------- | -- | -------------- |
47
+ | `AUTH_EMAIL_VERIFICATION` | 可选 | 设置为 `1` 启用邮箱验证 |
48
+
49
+ 这需要配置邮件服务(SMTP)。详情请参阅[邮件服务配置](/zh/docs/self-hosting/auth/email)。
50
+
51
+ ### 启用魔法链接登录
52
+
53
+ 允许通过邮件魔法链接实现无密码登录:
54
+
55
+ | 环境变量 | 类型 | 描述 |
56
+ | ------------------------ | -- | ---------------- |
57
+ | `AUTH_ENABLE_MAGIC_LINK` | 可选 | 设置为 `1` 启用魔法链接登录 |
58
+
59
+ 这也需要配置邮件服务(SMTP)。
60
+
61
+ ## 修改密码
62
+
63
+ 用户可以通过以下两种方式修改密码:
64
+
65
+ 1. **个人设置**:前往 设置 > 个人资料 修改密码
66
+ 2. **忘记密码**:在登录页面输入邮箱后,进入密码输入步骤,点击密码框下方的「忘记密码」
67
+
68
+ <Callout type={'info'}>
69
+ 以上两种方式都需要配置邮件服务(SMTP)以发送密码重置邮件。
70
+ </Callout>
71
+
72
+ ## 配置示例
73
+
74
+ ### 仅 SSO(禁用邮箱密码)
75
+
76
+ ```bash
77
+ AUTH_DISABLE_EMAIL_PASSWORD=1
78
+ AUTH_SSO_PROVIDERS=google,github
79
+ ```
80
+
81
+ ### 邮箱密码 + 邮箱验证
82
+
83
+ ```bash
84
+ AUTH_EMAIL_VERIFICATION=1
85
+ SMTP_HOST=smtp.example.com
86
+ SMTP_PORT=587
87
+ SMTP_USER=noreply@example.com
88
+ SMTP_PASS=your-password
89
+ ```
90
+
91
+ ### 邮箱密码 + 魔法链接
92
+
93
+ ```bash
94
+ AUTH_ENABLE_MAGIC_LINK=1
95
+ SMTP_HOST=smtp.example.com
96
+ SMTP_PORT=587
97
+ SMTP_USER=noreply@example.com
98
+ SMTP_PASS=your-password
99
+ ```
100
+
101
+ <Callout type={'tip'}>
102
+ 前往[环境变量](/zh/docs/self-hosting/environment-variables/auth)查看所有身份验证相关变量的详细信息。
103
+ </Callout>
@@ -61,6 +61,8 @@ To enable Better Auth in LobeHub, set the following environment variables:
61
61
  Click on a provider below for detailed configuration guides:
62
62
 
63
63
  <Cards>
64
+ <Card href={'/docs/self-hosting/advanced/auth/providers/password'} title={'Email/Password'} />
65
+
64
66
  <Card href={'/docs/self-hosting/advanced/auth/providers/github'} title={'GitHub'} />
65
67
 
66
68
  <Card href={'/docs/self-hosting/advanced/auth/providers/google'} title={'Google'} />
@@ -149,6 +151,16 @@ The current authentication system requires email. Please configure a valid email
149
151
 
150
152
  This applies to all authentication methods, including SSO providers like Casdoor. Always ensure users have valid email addresses configured.
151
153
 
154
+ ### How do I enable SSO-only mode (disable email/password login)?
155
+
156
+ Set `AUTH_DISABLE_EMAIL_PASSWORD=1` to disable email/password authentication. When enabled:
157
+
158
+ - The email input will be hidden on the login page, only SSO buttons are displayed
159
+ - The signup page will redirect to the login page
160
+ - Users can only log in via configured SSO providers
161
+
162
+ Make sure you have at least one SSO provider configured via `AUTH_SSO_PROVIDERS` before enabling this option.
163
+
152
164
  ### How do I restrict registration to specific emails or domains?
153
165
 
154
166
  Set the `AUTH_ALLOWED_EMAILS` environment variable with a comma-separated list of allowed emails or domains. For example:
@@ -61,6 +61,8 @@ LobeHub 支持使用 Better Auth 配置外部身份验证服务,供企业 /
61
61
  点击下方提供商查看详细配置指南:
62
62
 
63
63
  <Cards>
64
+ <Card href={'/zh/docs/self-hosting/advanced/auth/providers/password'} title={'邮箱密码'} />
65
+
64
66
  <Card href={'/zh/docs/self-hosting/advanced/auth/providers/github'} title={'GitHub'} />
65
67
 
66
68
  <Card href={'/zh/docs/self-hosting/advanced/auth/providers/google'} title={'Google'} />
@@ -150,6 +152,16 @@ Better Auth 支持内置提供商(Google、GitHub、Microsoft、Apple、AWS Co
150
152
 
151
153
  这适用于所有身份验证方式,包括 Casdoor 等 SSO 提供商。请确保用户配置了有效的邮箱地址。
152
154
 
155
+ ### 如何启用仅 SSO 模式(禁用邮箱密码登录)?
156
+
157
+ 设置 `AUTH_DISABLE_EMAIL_PASSWORD=1` 可禁用邮箱密码登录。启用后:
158
+
159
+ - 登录页面将隐藏邮箱输入框,仅显示 SSO 登录按钮
160
+ - 注册页面将重定向到登录页面
161
+ - 用户只能通过配置的 SSO 提供商登录
162
+
163
+ 启用此选项前,请确保已通过 `AUTH_SSO_PROVIDERS` 配置了至少一个 SSO 提供商。
164
+
153
165
  ### 如何限制只允许特定邮箱或域名注册?
154
166
 
155
167
  设置 `AUTH_ALLOWED_EMAILS` 环境变量,支持完整邮箱地址或域名,以逗号分隔。例如:
@@ -46,6 +46,13 @@ LobeHub provides a complete authentication service capability when deployed. The
46
46
  - Default: `-`
47
47
  - Example: `example.com,admin@other.com`
48
48
 
49
+ #### `AUTH_DISABLE_EMAIL_PASSWORD`
50
+
51
+ - Type: Optional
52
+ - Description: Set to `1` to disable email/password authentication, forcing users to use SSO login only. When enabled, the email input will be hidden on the login page and the signup page will redirect to login.
53
+ - Default: `0`
54
+ - Example: `1`
55
+
49
56
  #### `JWKS_KEY`
50
57
 
51
58
  - Type: Required
@@ -44,6 +44,13 @@ LobeHub 在部署时提供了完善的身份验证服务能力,以下是相关
44
44
  - 默认值:`-`
45
45
  - 示例:`example.com,admin@other.com`
46
46
 
47
+ #### `AUTH_DISABLE_EMAIL_PASSWORD`
48
+
49
+ - 类型:可选
50
+ - 描述:设置为 `1` 以禁用邮箱密码登录,强制用户使用 SSO 登录。启用后,登录页面将隐藏邮箱输入框,注册页面将重定向到登录页。
51
+ - 默认值:`0`
52
+ - 示例:`1`
53
+
47
54
  #### `JWKS_KEY`
48
55
 
49
56
  - 类型:必选
@@ -190,13 +190,6 @@ SSRF_ALLOW_IP_ADDRESS_LIST=192.168.1.100,10.0.0.50
190
190
  - Allow access to internal API gateway: `10.0.0.50`
191
191
  - Allow access to internal documentation server: `172.16.0.10`
192
192
 
193
- ### `ENABLE_AUTH_PROTECTION`
194
-
195
- - Type: Optional
196
- - Description: Controls whether to enable route protection. When set to `1`, all routes except public routes (like `/api/auth`, `/login`, `/signup`) will require authentication. When set to `0` or not set, only specific protected routes (like `/settings`, `/files`) will require authentication.
197
- - Default: `0`
198
- - Example: `1` or `0`
199
-
200
193
  ### `NEXT_PUBLIC_ASSET_PREFIX`
201
194
 
202
195
  - Type: Optional
@@ -185,13 +185,6 @@ SSRF_ALLOW_IP_ADDRESS_LIST=192.168.1.100,10.0.0.50
185
185
  - 允许访问内网 API 网关:`10.0.0.50`
186
186
  - 允许访问内网文档服务器:`172.16.0.10`
187
187
 
188
- ### `ENABLE_AUTH_PROTECTION`
189
-
190
- - 类型:可选
191
- - 说明:控制是否启用路由保护。当设置为 `1` 时,除了公共路由(如 `/api/auth`、`/login`、`/signup`)外,所有路由都需要认证。当设置为 `0` 或未设置时,只有特定的受保护路由(如 `/settings`、`/files` 等)需要认证。
192
- - 默认值:`0`
193
- - 示例:`1` 或 `0`
194
-
195
188
  ### `NEXT_PUBLIC_ASSET_PREFIX`
196
189
 
197
190
  - 类型:可选
@@ -40,4 +40,3 @@ If you want the deployed version to be pre-configured with Azure OpenAI for end
40
40
  | `AZURE_ENDPOINT` | Required | Azure API address, can be found in the "Keys and Endpoints" section when checking resources in the Azure portal | - | `https://docs-test-001.openai.azure.com` |
41
41
  | `AZURE_API_VERSION` | Required | Azure API version, following the format YYYY-MM-DD | 2023-08-01-preview | `-`, see [latest version](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions) |
42
42
  | `AZURE_MODEL_LIST` | Required | Used to control the model list, use `+` to add a model, use `-` to hide a model, use `id->deplymentName=displayName` to customize the display name of a model, separated by commas. Definition syntax rules see [Model List](/docs/self-hosting/advanced/model-list) | - | `gpt-35-turbo->my-deploy=GPT 3.5 Turbo` or `gpt-4-turbo->my-gpt4=GPT 4 Turbo<128000:vision:fc>` |
43
- | `ACCESS_CODE` | Optional | Add a password to access LobeHub. You can set a long password to prevent brute force attacks. When this value is separated by commas, it becomes an array of passwords | - | `awCT74` or `e3@09!` or `code1,code2,code3` |
@@ -42,4 +42,3 @@ LobeHub 支持使用 [Azure OpenAI](https://learn.microsoft.com/zh-cn/azure/ai-s
42
42
  | `AZURE_ENDPOINT` | 必选 | Azure API 地址,从 Azure 门户检查资源时,可在 “密钥和终结点” 部分中找到此值 | - | `https://docs-test-001.openai.azure.com` |
43
43
  | `AZURE_API_VERSION` | 必选 | Azure 的 API 版本,遵循 YYYY-MM-DD 格式 | 2023-08-01-preview | `-`,查阅[最新版本](https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference#chat-completions) |
44
44
  | `AZURE_MODEL_LIST` | 必选 | 用来控制模型列表,使用 `模型名->部署名=展示名` 来自定义模型的展示名,用英文逗号隔开。支持扩展能力,其余语法规则详见 [模型列表](/zh/docs/self-hosting/advanced/model-list) | - | `gpt-35-turbo->my-deploy=GPT 3.5 Turbo` 或 `gpt-4-turbo->my-gpt4=GPT 4 Turbo<128000:vision:fc>` |
45
- | `ACCESS_CODE` | 可选 | 添加访问 LobeHub 的密码,你可以设置一个长密码以防被爆破,该值用逗号分隔时为密码数组 | - | `awCT74` 或 `e3@09!` or `code1,code2,code3` |
@@ -98,6 +98,7 @@
98
98
  "betterAuth.signin.signupLink": "Sign up now",
99
99
  "betterAuth.signin.socialError": "Social sign in failed, please try again",
100
100
  "betterAuth.signin.socialOnlyHint": "This email was registered via a third-party social account. Sign in with that provider, or",
101
+ "betterAuth.signin.ssoOnlyNoProviders": "Email registration is disabled and no SSO providers are configured. Please contact your administrator.",
101
102
  "betterAuth.signin.submit": "Sign In",
102
103
  "betterAuth.signup.confirmPasswordPlaceholder": "Confirm your password",
103
104
  "betterAuth.signup.emailPlaceholder": "Enter your email address",
@@ -98,6 +98,7 @@
98
98
  "betterAuth.signin.signupLink": "创建账号",
99
99
  "betterAuth.signin.socialError": "登录遇到了问题,请重试",
100
100
  "betterAuth.signin.socialOnlyHint": "此邮箱是通过第三方社交账号注册的。请使用该服务提供商登录,或",
101
+ "betterAuth.signin.ssoOnlyNoProviders": "邮箱注册已禁用,且未配置 SSO 提供商。请联系管理员。",
101
102
  "betterAuth.signin.submit": "登录",
102
103
  "betterAuth.signup.confirmPasswordPlaceholder": "请确认密码",
103
104
  "betterAuth.signup.emailPlaceholder": "请输入邮箱地址",
package/netlify.toml CHANGED
@@ -7,4 +7,3 @@ NODE_OPTIONS = "--max-old-space-size=4096"
7
7
 
8
8
  [template.environment]
9
9
  OPENAI_API_KEY = "set your OpenAI API Key"
10
- ACCESS_CODE = "set your password to protect your api key"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/lobehub",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "LobeHub - an open-source,comprehensive AI Agent framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",
@@ -49,6 +49,7 @@ export type ServerLanguageModel = Partial<Record<GlobalLLMProviderKey, ServerMod
49
49
  export interface GlobalServerConfig {
50
50
  aiProvider: ServerLanguageModel;
51
51
  defaultAgent?: PartialDeep<UserDefaultAgent>;
52
+ disableEmailPassword?: boolean;
52
53
  enableBusinessFeatures?: boolean;
53
54
  enableEmailVerification?: boolean;
54
55
  enableKlavis?: boolean;