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:
smartcat999
2025-02-28 16:57:36 +08:00
committed by hongming
parent e7c97d3a56
commit f1bb9d69ac

View File

@@ -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
}
}
}