Skip to content

Add shared events for listening user login and logout in plugins #7440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 23, 2025

Conversation

liuyiwuqing
Copy link
Contributor

@liuyiwuqing liuyiwuqing commented May 16, 2025

What type of PR is this?

/kind improvement

What this PR does / why we need it:

This PR adds UserLoginEvent and UserLogoutEvent which are shared to plugins.

Which issue(s) this PR fixes:

Fixes #7436

Does this PR introduce a user-facing change?

添加用户登录/登出事件

#### What type of PR is this?
/kind improvement

#### What this PR does / why we need it:
添加用户登录事件和相关处理逻辑

#### Which issue(s) this PR fixes:
halo-dev#7436
@CLAassistant
Copy link

CLAassistant commented May 16, 2025

CLA assistant check
All committers have signed the CLA.

@f2c-ci-robot f2c-ci-robot bot added kind/improvement Categorizes issue or PR as related to a improvement. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels May 16, 2025
@JohnNiang JohnNiang added this to the 2.21.x milestone May 19, 2025
@JohnNiang JohnNiang changed the title feat(core): 添加用户登录事件和相关处理逻辑 Add support for listening a shared event while users log in May 21, 2025
@f2c-ci-robot f2c-ci-robot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels May 21, 2025
Copy link

codecov bot commented May 21, 2025

Codecov Report

Attention: Patch coverage is 0% with 19 lines in your changes missing coverage. Please review.

Project coverage is 59.50%. Comparing base (c73f0dd) to head (2fe6f83).
Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
...core/user/service/UserLoginOrLogoutProcessing.java 0.00% 10 Missing ⚠️
...n/java/run/halo/app/event/user/UserLoginEvent.java 0.00% 3 Missing ⚠️
.../java/run/halo/app/event/user/UserLogoutEvent.java 0.00% 3 Missing ⚠️
...un/halo/app/security/LoginHandlerEnhancerImpl.java 0.00% 2 Missing ⚠️
...un/halo/app/security/LogoutSecurityConfigurer.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7440      +/-   ##
============================================
- Coverage     59.51%   59.50%   -0.02%     
- Complexity     3803     3811       +8     
============================================
  Files           677      680       +3     
  Lines         23225    23266      +41     
  Branches       1496     1500       +4     
============================================
+ Hits          13823    13844      +21     
- Misses         8763     8783      +20     
  Partials        639      639              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contribution!

I left some comments below, please take some time to have a look.

-移除 UserLoginEvent 和 UserLogoutEvent 中的冗余状态字段- 更新 LoginHandlerEnhancerImpl 和 LogoutSecurityConfigurer 中的登录处理方法
- 修改 UserLoginOrLogoutProcessing 中的登录和登出方法,移除不必要的状态参数
Copy link

@JohnNiang JohnNiang changed the title Add support for listening a shared event while users log in Add shared events for listening user login and logout in plugins May 23, 2025
Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label May 23, 2025
Copy link

f2c-ci-robot bot commented May 23, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JohnNiang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 23, 2025
@f2c-ci-robot f2c-ci-robot bot merged commit 5c27a04 into halo-dev:main May 23, 2025
9 checks passed
@ruibaby
Copy link
Member

ruibaby commented May 26, 2025

@liuyiwuqing
Copy link
Contributor Author

建议完善关于这个事件的文档。

https://docs.halo.run/developer-guide/plugin/interaction/shared-events#halo-%E5%86%85%E7%BD%AE%E5%85%B1%E4%BA%AB%E4%BA%8B%E4%BB%B6

docs(事件): 补充用户登录和登出事件文档 #497

@JohnNiang JohnNiang modified the milestones: 2.21.x, 2.21.0 Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/improvement Categorizes issue or PR as related to a improvement. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Halo 内置共享事件 新增关于用户登录相关的事件
4 participants