Skip to content
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

fix: ignore logic must be first #36

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

beliefgp
Copy link

@beliefgp beliefgp commented Aug 9, 2018

当 session 存在时但是用户信息不存在时,而当前请求是 /login,但是我的ignore 逻辑中因为其他一些条件的限制,也会导致该请求不进入登录页。

我认为这里的 ignore 逻辑应该和 egg 的 ignore 逻辑一样,命中 ignore,整个中间件逻辑都不再执行。

@beliefgp beliefgp changed the title fix: should check user info in session, not only check session exist fix: ignore logic must be first Aug 9, 2018
@denghongcai
Copy link
Collaborator

代码清理一下,其他感觉合理

LGTM

@beliefgp
Copy link
Author

@denghongcai done

@fengmk2
Copy link
Member

fengmk2 commented Aug 10, 2018

Please add a unit test for this bugfix

@beliefgp
Copy link
Author

beliefgp commented Aug 10, 2018

@fengmk2 千总,不过,这样改的话,你们原来的 matchs 那块的单测基本都要改逻辑了……
所以不确认你们最开始考虑的初衷是什么,也许是我没有考虑到的。

不过按原有逻辑的话,如果别的中间件操作了 session 的话,就会影响这边的逻辑走向。

  1. 别的中间件,把 session 重置, session 不存在,就会先验证 ignore
  2. 别的中间件,初始化 session,session 存在,就会先验证 path 是不是 login、logout,再验证 ignore。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants