Resolve 'When the user created by gitlab api logs in for the first time, 500 error is reported'
What does this MR do and why?
Fix bug 'When the user created by gitlab api logs in for the first time, 500 error is reported' closes #2257 (closed)
Bug Reason:
Some actions that create new users do not create user_detail. (e.g. api creates new user, signup creates new user). Validation for password expiration requires access to user_detail, throwing a null pointer error.
Solution:
Initially, we wanted to create user_detail
when creating a new user. Because there are many ways to create a new user, we wanted to add a save callback to the model layer, but this caused a lot of test cases to fail.
In the end we gave up on the idea above and modified the verification logic for password expiration to support null pointers, even though this would lose some of the accuracy of password verification.
Screenshots or screen recordings
How to set up and validate locally
- use create_user api to create user
url https://staging.jihulab.com/api/v4/users?private_token=xxxx
post body:
admin:false
email:qa-user-8fcd80b64f037cda@example.com
password:Pa$$w0rd
username:qa-user-8fcd80b64f037cda
name:QA User 8fcd80b64f037cda
skip_confirmation:true
- Log in to gitlab with a new user
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #2257 (closed)