fix: Fixed the issue where the user status was empty when the third-p… (#6379)
fix: Fixed the issue where the user status was empty when the third-p… (#2258)
* fix: Fixed the issue where the user status was empty when the third-party login user logged in manually for the first time
* fix: Fixed the issue where the user status was empty when the third-party login user logged in manually for the first time
---------
Signed-off-by: peng wu <2030047311@qq.com>
(cherry picked from commit 8056d176f8)
This commit is contained in:
@@ -269,13 +269,15 @@ func (r *Reconciler) reconcileUserStatus(ctx context.Context, user *iamv1beta1.U
|
||||
}
|
||||
|
||||
// becomes active after password encrypted
|
||||
if user.Status.State == "" && isEncrypted(user.Spec.EncryptedPassword) {
|
||||
user.Status = iamv1beta1.UserStatus{
|
||||
State: iamv1beta1.UserActive,
|
||||
LastTransitionTime: &metav1.Time{Time: time.Now()},
|
||||
}
|
||||
if err := r.Update(ctx, user, &client.UpdateOptions{}); err != nil {
|
||||
return err
|
||||
if user.Status.State == "" {
|
||||
if user.Spec.EncryptedPassword == "" || isEncrypted(user.Spec.EncryptedPassword) {
|
||||
user.Status = iamv1beta1.UserStatus{
|
||||
State: iamv1beta1.UserActive,
|
||||
LastTransitionTime: &metav1.Time{Time: time.Now()},
|
||||
}
|
||||
if err := r.Update(ctx, user, &client.UpdateOptions{}); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user