s3: improve credentials validation

access secret can now be empty, so check if not empty before encrypting
the secret
This commit is contained in:
Nicola Murino
2020-02-16 10:14:44 +01:00
parent dbd75209df
commit 58253968fc
5 changed files with 43 additions and 10 deletions

View File

@@ -127,7 +127,7 @@ func updateUser(w http.ResponseWriter, r *http.Request) {
// we use the new access secret if different from the old one and not empty
if user.FsConfig.Provider == 1 {
if utils.RemoveDecryptionKey(currentS3AccessSecret) == user.FsConfig.S3Config.AccessSecret ||
len(user.FsConfig.S3Config.AccessSecret) == 0 {
(len(user.FsConfig.S3Config.AccessSecret) == 0 && len(user.FsConfig.S3Config.AccessKey) > 0) {
user.FsConfig.S3Config.AccessSecret = currentS3AccessSecret
}
}