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

Hash messed up due to two competing AdminUserService instances #221

Open
WintonLi opened this issue Apr 25, 2021 · 0 comments
Open

Hash messed up due to two competing AdminUserService instances #221

WintonLi opened this issue Apr 25, 2021 · 0 comments

Comments

@WintonLi
Copy link

@williamdclt
The problem
There are a few reports about the failure of logging into admin panel after creating the admin user.

Reasons
There are two AdminUserService instances, both listening to the beforeInsert event. So when the password of an admin account being created is set, hashed, and saved to the database, the saving operation will immediately be captured by the other instance, which performs a hash to the hashed password, resulting in the final password hash stored in the database being double-hashed, and consequently the failure of login to the admin panel.

Evidence
This can be verified by console.log from the constructor of the AdminUserService class. I could see the contents got logged twice.

Solution/ PR
Unfortunately the problem is beyond my understanding. I am confused about why two service instances are being used, as can be seen in adminUser.module.ts that it's been provided/ injected in multiple places - normally a service should be singleton.

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

No branches or pull requests

1 participant