Commit Graph

5372 Commits (329bcc5748179b8760a31910e4ac34ede201640c)

Author SHA1 Message Date
Ryan Wang d0f3933095
feat: improve built-in auth providers' i18n (#6814)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

完善内置的认证提供商的 i18n。

<img width="859" alt="image" src="https://github.com/user-attachments/assets/a145fc98-05f0-4d62-805a-f3b4f4380a04">

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-10 08:25:01 +00:00
Ryan Wang d6c914f4c6
refactor: improve ui of logout page (#6810)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

优化退出登录页面的 UI。

<img width="568" alt="image" src="https://github.com/user-attachments/assets/dd3b405b-e200-478a-ba87-b0d474e6ee1f">


#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-10 08:23:01 +00:00
guqing fbe40c28fc
chore: restrict username and password length during user registration (#6808)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.20.x

#### What this PR does / why we need it:
为注册用户增加用户名和密码长度校验

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-10-10 07:57:00 +00:00
guqing 605d52a86e
refactor: optimize file type detection and support decision-making based on file name (#6675)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.20.x

#### What this PR does / why we need it:
优化文件类型检测并支持根据文件名作为决策依据

#### Does this PR introduce a user-facing change?
```release-note
优化文件类型检测并支持根据文件名作为决策依据
```
2024-10-10 07:45:00 +00:00
Ryan Wang 2b3badc8e1
refactor: update login-related page templates structure (#6813)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

重构登录、注册相关的模板结构,主要目的是为了解耦,修改页面时仅修改相关的模板和语言文件。

重构之后主题的引用方式如下:

login.html

```html
<div th:replace="~{gateway_fragments/login::form}"></div>
```

#### Special notes for your reviewer:

需要测试各个页面是否功能正常

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-10 07:33:00 +00:00
Ryan Wang 01a781c54a
feat: improve password confirmation validation for forms (#6807)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

完善部分表单的确定密码校验。

1. 封装单独的校验函数。
2. 完善 i18n。

<img width="676" alt="image" src="https://github.com/user-attachments/assets/af8a4edc-d6ba-419f-b7ba-baa9d488186d">

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-10 07:17:00 +00:00
John Niang cae871f9e6
Fix the problem of accessing logout page without authentication (#6812)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.20.x

#### What this PR does / why we need it:

Currently, logout page is always visible for anyone whether the user is authenticated. This PR restricts the visibility of logout page to authenticated users but anonymous users.

#### Special notes for your reviewer:

```bash
> http http://localhost:8090/logout

HTTP/1.1 302 Found
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Expires: 0
Location: /login?authentication_required
Pragma: no-cache
Referrer-Policy: strict-origin-when-cross-origin
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 0
content-length: 0
```

#### Does this PR introduce a user-facing change?

```release-note
修复未登录情况下依然能够访问登出页面的问题
```
2024-10-10 05:43:00 +00:00
guqing 9e3f77baf3
fix: avoid NPE by skipping nonexistent notifiers in user preferences (#6811)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.20.x

#### What this PR does / why we need it:
修复当用户通知偏好设置中出现不存在的通知器名称时会导致 NPE 的问题

此问题可能发生在,通知器由插件或者专业版提供并且修改了偏好设置后禁用了插件或切换到开源版导致找不到该通知器的记录

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-10-10 05:27:00 +00:00
Ryan Wang 9cbd9b23d0
fix: username length validation in user creation form is not working (#6806)
#### What type of PR is this?

/area ui
/kind bug
/milestone 2.20.x

#### What this PR does / why we need it:

修复创建用户表单的用户名长度校验不生效的问题。

#### Does this PR introduce a user-facing change?

```release-note
修复创建用户表单的用户名长度校验不生效的问题。
```
2024-10-10 03:05:00 +00:00
John Niang 158c3e8a9e
Merge pull request #6804 from guqing/refactor/user-validation
refactor: unified validation for username and password format
2024-10-10 10:45:38 +08:00
Ryan Wang d7aba83485 Refine password validation 2024-10-10 10:43:20 +08:00
guqing d6df340fe4 refactor: unified validation for username and password format 2024-10-09 17:38:34 +08:00
John Niang ec75564f37
Refactor password reset for extensibility (#6803)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.20.x

#### What this PR does / why we need it:

This PR refactors password reset for extensibility. If we want to add another password reset method, first thing we need to do is adding a new password reset method into `halo.security.password-reset-methods[]` and then defining PasswordResetAvailabilityProvider bean.

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-09 09:04:57 +00:00
Ryan Wang 0e4a19d182
refactor: prevent password field from displaying encrypted text (#6801)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

在提交登录表单时,不在密码框中显示加密文本。

#### Which issue(s) this PR fixes:

Fixes #6799 

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-09 09:02:58 +00:00
John Niang 5c50779693
Xor CSRF token (#6798)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.20.x

#### What this PR does / why we need it:

This PR makes XOR operation for CSRF token and changes the CSRF cookie `HttpOnly` to `true` to forbid JavaScript from accessing the cookie.

See https://docs.spring.io/spring-security/reference/servlet/exploits/csrf.html#csrf-token-request-handler-breach for more details.

#### Special notes for your reviewer:

```bash
http http://localhost:8090/login -ph

HTTP/1.1 200 OK
set-cookie: XSRF-TOKEN=6d5dd83f-f0a7-4d94-a33e-73f213d679ff; Path=/; HTTPOnly
```

```bash
http http://localhost:8090/login -pb | grep _csrf

><input type="hidden" name="_csrf" value="ctubmrEC3dAbxC5H_k_-VnVUtih2BrfjcPfLmVAyaP0a1kAdEb-t_IcwuLM29B11yGLKNRQxm0lFZILOFZX-_GcHWJ974iR5"/>
```

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-09 09:00:57 +00:00
Ryan Wang 845893944c
Merge pull request #6739 from guqing/refactor/6722
refactor: system initialization process to adapt to the new login method
2024-10-09 14:58:14 +08:00
Ryan Wang 82fb91fc7b
refactor: improve password input toggle button state display (#6800)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

优化密码输入框的明文切换图标的状态显示。

before:

<img width="508" alt="image" src="https://github.com/user-attachments/assets/5ae12beb-ce23-40a2-ad08-8e47c2eb6813">

after:

<img width="519" alt="image" src="https://github.com/user-attachments/assets/712e1735-a7ad-40f4-8900-a8c92eda7e54">


#### Does this PR introduce a user-facing change?

```release-note
优化密码输入框的明文切换图标的状态显示。
```
2024-10-09 06:52:56 +00:00
Ryan Wang 5df755d4a8 Refine setup page 2024-10-09 12:20:54 +08:00
guqing bba242332d refactor: system initialization process to adapt to the new login method
Signed-off-by: guqing <i@guqing.email>
2024-10-09 12:20:27 +08:00
guqing 2585636c48
feat: allow users to manage their attachments in uc (#6731)
#### What type of PR is this?
/kind feature
/milestone 2.20.x
/area core

#### What this PR does / why we need it:
支持用户在个人中心管理自己的附件(需要具有对应权限)

Fixes https://github.com/halo-dev/halo/issues/5278

#### Does this PR introduce a user-facing change?
```release-note
支持用户在个人中心管理自己的附件(需要具有对应权限)
```
2024-10-08 14:56:55 +00:00
Ryan Wang edb3f1c617
feat: add login link to signup page (#6780)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

在注册表单底部添加登录入口。

<img width="693" alt="image" src="https://github.com/user-attachments/assets/dafc48bb-c16e-4d9b-95f7-b44e2f14ed6f">

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/6770

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-08 14:54:56 +00:00
Ryan Wang 786cb1b260
fix: can not display error message for duplicate username during signup (#6789)
#### What type of PR is this?

/area core
/kind bug
/milestone 2.20.x

#### What this PR does / why we need it:

修复注册时,不能正常显示用户名重复的错误的问题。

<img width="666" alt="image" src="https://github.com/user-attachments/assets/bef83af1-ab9d-4c84-8c3e-0d4f8a6892f3">

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-08 14:52:56 +00:00
Ryan Wang 672b2d86c7
fix: style issue of the fullscreen button in Code input (#6785)
#### What type of PR is this?

/area ui
/kind bug
/milestone 2.20.x

#### What this PR does / why we need it:

为 Code Input 设置默认高度,修复全屏按钮被遮挡的问题。

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/6681

#### Does this PR introduce a user-facing change?

```release-note
为 Code Input 设置默认高度,修复全屏按钮被遮挡的问题。
```
2024-10-08 14:50:56 +00:00
John Niang e667719dd7
Redirect to user center after authenticating successfully (#6797)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.20.x

#### What this PR does / why we need it:

This PR changes the redirect URI to `/uc` instead of `/console` after authenticating successfully.

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-08 14:10:54 +00:00
Ryan Wang c82b65be99
chore: bump preset theme version (#6794)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

更新默认主题的版本。

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-08 10:32:54 +00:00
Ryan Wang 16641e3331
refactor: improve error message styling for reset password form (#6791)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

优化重置密码表单的错误提示样式。

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-08 10:30:55 +00:00
Ryan Wang 2555cbf6ff
fix: JavaScript error on signup page (#6788)
#### What type of PR is this?

/area core
/kind bug
/milestone 2.20.x

#### What this PR does / why we need it:

修复注册页面的 JS 错误。

#### Does this PR introduce a user-facing change?

```release-note
None 
```
2024-10-08 10:28:55 +00:00
Ryan Wang c39f937b5b
chore: add LIlGG as a approver (#6795) 2024-10-08 18:25:22 +08:00
Ryan Wang 479b439ce4
chore: bump preset plugins version (#6792)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

升级预设插件的版本。

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-08 09:14:54 +00:00
Ryan Wang 223eb88b10
refactor: update local login method icons (#6783)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

更新本地登录方式的图标。

<img width="514" alt="image" src="https://github.com/user-attachments/assets/d8624548-c1b1-4f26-bf2f-353f127af7e5">


#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/6759

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-08 08:58:53 +00:00
John Niang f1d5911bb3
Fix the problem of not being able to resolve headers correctly (#6786)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.20.x

#### What this PR does / why we need it:

This PR changes server.forward-header-strategy to native instead of framework due to a bug of Spring Framework 6.20.0-RC.1.

See https://github.com/spring-projects/spring-framework/pull/32097#discussion_r1791264218 for more.

If Halo server is proxied by OpenResty which is using HTTP 2, all header names proxied into Halo server will be lowercase. This behavior makes Halo get a null header(e.g.:: `content-type: application/json`) while invoking `request.getHeaders().getContentType()`.

And I found that `ServerHttpRequest` is mutated by `org.springframework.web.server.adapter.ForwardedHeaderTransformer`, so I try to use native forward-header-strategy to resolve the problem and it works very well. See [reactor.netty.http.server.DefaultHttpForwardedHeaderHandler](446683826b/reactor-netty-http/src/main/java/reactor/netty/http/server/DefaultHttpForwardedHeaderHandler.java) for more.

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-08 08:24:54 +00:00
Ryan Wang 1d31d32312
fix: resolve issue with code input can not displaying fullscreen in modal component (#6787)
#### What type of PR is this?

/area ui
/kind bug
/milestone 2.20.x

#### What this PR does / why we need it:

修复 Code 输入框在模态框(VModal)组件中无法正常全屏显示的问题。

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/6682

#### Does this PR introduce a user-facing change?

```release-note
修复 Code 输入框在模态框(VModal)组件中无法正常全屏显示的问题。
```
2024-10-08 08:06:53 +00:00
Takagi f632322dba
pref: remove anonymous and ghost users from the userSelect (#6781)
#### What type of PR is this?

/kind improvement
/area ui
/milsetone 2.20.x

#### What this PR does / why we need it:

在 userSelect 查询用户列表时,移除匿名与已删除用户这两个保留用户。

#### How to test it?

在文章设置,用户列表中不存在匿名与已删除用户即可。

#### Which issue(s) this PR fixes:

Fixes #6665 

#### Does this PR introduce a user-facing change?
```release-note
在 user select 中不再显示匿名与已删除用户。
```
2024-10-08 07:28:54 +00:00
John Niang 9d01b627d0
Customize authorization exchange separately (#6779)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.20.x

#### What this PR does / why we need it:

This PR separates authorization exchange customization into security configurers. I also define the annotations `@Order` on every security configurer in order to customize authorization exchange in separated source file instead of modifying existing.

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-07 15:50:53 +00:00
Ryan Wang c3ecd339a1
feat: refine i18n for login method selection button (#6771)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

完善登录方式选择按钮的 i18n。

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/6759

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-07 15:22:52 +00:00
John Niang dfbab283ef
Merge pull request #6729 from guqing/feature/5851
feat: support deleting posts in user center
2024-10-07 17:48:26 +08:00
Ryan Wang f78f7dad02
feat: add support to check access permissions for /console (#6775)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

支持检查是否有权限访问 /console。

#### Which issue(s) this PR fixes:

Fixes #6773 

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-07 09:38:51 +00:00
Ryan Wang 709884212a
refactor: login-related page templates structure (#6769)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

Fixes https://github.com/halo-dev/halo/issues/6760

重构登录、注册、找回密码、两步验证等模板的结构,提供更好的复用性,现在主题可以这样复用模板:

login.html

```html
<form th:replace="~{gateway_modules/form_fragments::login}"></form>
```

signup.html

```html
<form th:replace="~{gateway_modules/form_fragments::signup}"></form>
```

challenges/two-factor/totp.html

```html
<form th:replace="~{gateway_modules/form_fragments::totp}"></form>
```

#### Special notes for your reviewer:

需要测试各个页面是否功能正常

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-07 09:28:51 +00:00
guqing 04e195f034
fix: unique index conflict issue after backup restoration preventing startup (#6701)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.20.x
/sig docs

#### What this PR does / why we need it:
修复恢复备份后可能会因为与之前的数据冲突导致无法启动的问题

如果恢复时发生不可预知的错误,需要重启之后重新初始化再进行恢复

#### Which issue(s) this PR fixes:
Fixes #6672

#### Does this PR introduce a user-facing change?
```release-note
修复恢复备份后可能会因为与恢复之前存在的数据冲突导致无法启动的问题
```
2024-10-07 09:20:50 +00:00
Ryan Wang ea491f2386
chore: bump tiptap version to 2.8.x (#6777)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

Bump tiptap verison to [2.8.x](https://github.com/ueberdosis/tiptap/releases/tag/v2.8.0)

#### Does this PR introduce a user-facing change?

```release-note
升级编辑器依赖 Tiptap 的版本至 [2.8.x](https://github.com/ueberdosis/tiptap/releases/tag/v2.8.0)。
```
2024-10-07 04:28:51 +00:00
Ryan Wang d6489283b8
refactor: remove redirect-on-login setting option from role editing form (#6776)
#### What type of PR is this?

/area ui
/kind api-change
/milestone 2.20.x

#### What this PR does / why we need it:

See #6774 

#### Which issue(s) this PR fixes:

Fixes #6774 

#### Does this PR introduce a user-facing change?

```release-note
移除角色的 **登录之后默认跳转位置** 设置选项。
```
2024-10-07 04:26:50 +00:00
Ryan Wang b0ad0406b9
fix: resolve issue with logout functionality in Console not working (#6766)
#### What type of PR is this?

/area ui
/kind bug
/milestone 2.20.x

#### What this PR does / why we need it:

修复 Console 中退出登录功能失效的问题。

#### Which issue(s) this PR fixes:

Fixes #6756 

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-05 06:38:44 +00:00
Ryan Wang 8896e16615
feat: disallow deletion of system-protected attachment policies (#6735)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

为系统默认的存储策略添加保护措施,不允许删除。

<img width="893" alt="image" src="https://github.com/user-attachments/assets/990f834f-3d97-4ee8-9c24-01cc188b7be6">


#### Does this PR introduce a user-facing change?

```release-note
为系统默认的存储策略添加保护措施,不允许删除。
```
2024-10-04 14:10:44 +00:00
Ryan Wang 4dd5b7e103
feat: add link prefetch for logo resource on login page (#6751)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

为登录页面的 Logo 资源添加 link prefetch 标签,以缓解页面抖动的问题。

before:

https://github.com/user-attachments/assets/ec718b62-6593-4deb-a028-bcb3d8504c4e

after:

https://github.com/user-attachments/assets/8d408408-37bd-4cdc-a22a-b39531fa505f

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-04 14:02:44 +00:00
Ryan Wang cf7746be6d
refactor: exclude indices directory during backup (#6753)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

备份时排除全文索引目录 indices,防止恢复之后因为索引文件问题无法启动。

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/6443

#### Does this PR introduce a user-facing change?

```release-note
备份时排除全文索引目录 indices,防止恢复之后因为索引文件问题无法启动。
```
2024-10-04 12:48:43 +00:00
Ryan Wang c941e37435
refactor: enhance login page styling for improved UX (#6757)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

微调登录相关页面的样式。

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-04 12:44:43 +00:00
John Niang 38b7898899
Upgrade to jsoup 1.18.1 (#6765)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.20.x

#### What this PR does / why we need it:

This PR upgrades to jsoup 1.18.1. See https://github.com/jhy/jsoup/releases/tag/jsoup-1.18.1 for more.

#### Does this PR introduce a user-facing change?

```release-note
升级依赖 jsoup 至 1.18.1
```
2024-10-04 12:34:42 +00:00
Ryan Wang 1852784a4c
chore: bump vue version to 3.5.11 (#6764)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

Bump vue version to [3.5.11](https://github.com/vuejs/core/blob/main/CHANGELOG.md#3511-2024-10-03)

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-04 12:22:43 +00:00
John Niang 6ac8c9b2f7
Upgrade to Lucene 9.12.0 (#6763)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.20.x

#### What this PR does / why we need it:

This PR upgrades to Lucene 9.12.0. See https://lucene.apache.org/core/9_12_0/changes/Changes.html for more.

#### Does this PR introduce a user-facing change?

```release-note
升级依赖 Lucene 至 9.12.0
```
2024-10-04 11:58:42 +00:00
John Niang b3fa0b9568
Upgrade to Guava 33.3.1-jre (#6762)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.20.x

#### What this PR does / why we need it:

This PR upgrades to Guava 33.3.1-jre. See https://github.com/google/guava/releases/tag/v33.3.1 for more.

#### Does this PR introduce a user-facing change?

```release-note
升级依赖 Guava 至 33.3.1-jre
```
2024-10-04 11:54:43 +00:00