webkom / lego

Backend for abakus.no
https://lego.abakus.no
MIT License
52 stars 20 forks source link

Set password hash for external sync on newly created users #3588

Closed eikhr closed 2 months ago

eikhr commented 2 months ago

The reason GSuite sync only works after changing password, is that the password hash used for external sync was not set correctly when creating users. The logic for setting this hash is implemented in the set_password() method which is not called when creating a new user.

I wasn't able to add any logic with access to the new password in the PasswordHashUser-model, so I just added a call to set_password right after creating new user.

resolves ABA-578

Although this will fix the problem for new users, there is still probably a lot of users that have never changed their password and thus do not have the saved hash. It might be worth adding some warning whenever we try to sync a user with a missing hash.

linear[bot] commented 2 months ago

ABA-578 Fix google user syncing

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 89.13%. Comparing base (4b7b6f9) to head (ca27236).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #3588 +/- ## ======================================= Coverage 89.13% 89.13% ======================================= Files 681 681 Lines 21386 21391 +5 ======================================= + Hits 19062 19067 +5 Misses 2324 2324 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

eikhr commented 2 months ago

Hmm, yeah that should work. Good idea!