From 228ecf9b78251e7cc15bae56db7c5ab99528159b Mon Sep 17 00:00:00 2001 From: Wenkai Yin Date: Mon, 10 Apr 2017 17:25:10 +0800 Subject: [PATCH] bug fix --- src/ui/api/target.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ui/api/target.go b/src/ui/api/target.go index 7161d44ec..8f49a415d 100644 --- a/src/ui/api/target.go +++ b/src/ui/api/target.go @@ -245,6 +245,13 @@ func (t *TargetAPI) Put() { if hasEnabledPolicy { t.CustomAbort(http.StatusBadRequest, "the target is associated with policy which is enabled") } + if len(target.Password) != 0 { + target.Password, err = utils.ReversibleDecrypt(target.Password, t.secretKey) + if err != nil { + log.Errorf("failed to decrypt password: %v", err) + t.CustomAbort(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError)) + } + } req := struct { Name *string `json:"name"`