yjp 1 рік тому
батько
коміт
e0d8fb49c3
1 змінених файлів з 5 додано та 5 видалено
  1. 5 5
      convenient/domain/auth/user/api.go

+ 5 - 5
convenient/domain/auth/user/api.go

@@ -265,22 +265,22 @@ func (simple *Simple) Bind(binder *binding.Binder) {
 			},
 		}), entity_crud.WithGetByIDCallbacks(&entity_crud.GetByIDCallbacks[Info]{
 			OnSuccessReturn: func(e entity.Entity, i *infrastructure.Infrastructure, output Info) (Info, error) {
-				if strutils.IsStringNotEmpty(output.Name) {
-					encryptedName, err := encoding.AESEncrypt(output.Name, simple.AESKey)
+				if strutils.IsStringNotEmpty(output.Phone) {
+					decryptedPhone, err := encoding.AESDecrypt(output.Phone, simple.AESKey)
 					if err != nil {
 						return Info{}, errors.New(err.Error())
 					}
 
-					output.Name = encryptedName
+					output.Phone = decryptedPhone
 				}
 
 				if strutils.IsStringNotEmpty(output.Email) {
-					encryptedEmail, err := encoding.AESEncrypt(output.Email, simple.AESKey)
+					decryptedEmail, err := encoding.AESDecrypt(output.Email, simple.AESKey)
 					if err != nil {
 						return Info{}, errors.New(err.Error())
 					}
 
-					output.Email = encryptedEmail
+					output.Email = decryptedEmail
 				}
 
 				return output, nil