diff --git a/go.mod b/go.mod index 6fe50f8b..e1a2dcd9 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/drakkan/sftpgo/v2 go 1.21 require ( - cloud.google.com/go/storage v1.35.1 + cloud.google.com/go/storage v1.36.0 github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1 github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0 github.com/GehirnInc/crypt v0.0.0-20230320061759-8cc1b52080c5 diff --git a/go.sum b/go.sum index 04e7096c..f5ec7f15 100644 --- a/go.sum +++ b/go.sum @@ -9,8 +9,8 @@ cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= cloud.google.com/go/kms v1.15.5 h1:pj1sRfut2eRbD9pFRjNnPNg/CzJPuQAzUujMIM1vVeM= cloud.google.com/go/kms v1.15.5/go.mod h1:cU2H5jnp6G2TDpUGZyqTCoy1n16fbubHZjmVXSMtwDI= -cloud.google.com/go/storage v1.35.1 h1:B59ahL//eDfx2IIKFBeT5Atm9wnNmj3+8xG/W4WB//w= -cloud.google.com/go/storage v1.35.1/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= +cloud.google.com/go/storage v1.36.0 h1:P0mOkAcaJxhCTvAkMhxMfrTKiNcub4YmmPBtlhAyTr8= +cloud.google.com/go/storage v1.36.0/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1 h1:lGlwhPtrX6EVml1hO0ivjkUxsSyl4dsiw9qcA1k/3IQ= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1/go.mod h1:RKUqNu35KJYcVG/fqTRqmuXJZYNhYkBrnC/hX7yGbTA= diff --git a/templates/webclient/base.html b/templates/webclient/base.html index 02c319b8..92b8946f 100644 --- a/templates/webclient/base.html +++ b/templates/webclient/base.html @@ -294,6 +294,25 @@ explicit grant from the SFTPGo Team (support@sftpgo.com). +
+ +
+ {{- block "modals" .}}{{- end}} @@ -393,6 +412,11 @@ explicit grant from the SFTPGo Team (support@sftpgo.com). } }(); + function showToast(msg, options) { + const toast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast_container')); + setI18NData($('#toast_msg'), msg, options) + toast.show(); + } function doLogout() { ModalAlert.fire({ diff --git a/templates/webclient/files.html b/templates/webclient/files.html index f61d41c9..59e1a176 100644 --- a/templates/webclient/files.html +++ b/templates/webclient/files.html @@ -31,21 +31,21 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
{{- if .CanCreateDirs}} - {{- end}} {{- if .CanAddFiles}} - {{- end}}
@@ -61,8 +61,8 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
{{- if or .CanDownload .CanDelete}}
-
diff --git a/templates/webclient/mfa.html b/templates/webclient/mfa.html index 9e2c9148..5893e3d9 100644 --- a/templates/webclient/mfa.html +++ b/templates/webclient/mfa.html @@ -56,8 +56,6 @@ explicit grant from the SFTPGo Team (support@sftpgo.com). - {{- template "errmsg" ""}} -
@@ -470,18 +468,13 @@ explicit grant from the SFTPGo Team (support@sftpgo.com). return; } - let errDivEl = $('#errorMsg'); - let errTxtEl = $('#errorTxt'); if ($('#id_protocols').find('option:selected').length == 0){ - setI18NData(errTxtEl, '2fa.no_protocol'); - errDivEl.removeClass("d-none"); + showToast('2fa.no_protocol'); return; } let errorMessage = '2fa.auth_secret_gen_err'; - $('#id_secret').text(""); - errDivEl.addClass("d-none"); el.setAttribute('data-kt-indicator', 'on'); el.disabled = true; @@ -499,8 +492,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com). el.removeAttribute('data-kt-indicator'); el.disabled = false; if (!response.data.secret) { - setI18NData(errTxtEl, errorMessage); - errDivEl.removeClass("d-none"); + showToast(errorMessage); return; } $('#id_secret').text(response.data.secret); @@ -517,8 +509,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com). }).catch(function (error){ el.removeAttribute('data-kt-indicator'); el.disabled = false; - setI18NData(errTxtEl, errorMessage); - errDivEl.removeClass("d-none"); + showToast(errorMessage); }); } @@ -529,22 +520,18 @@ explicit grant from the SFTPGo Team (support@sftpgo.com). if (!configName) { configName = $('#id_config option:selected').val(); } - let errDivEl = $('#errorMsg'); - let errTxtEl = $('#errorTxt'); let errorMessage = '2fa.save_err'; let protocolsArray = []; $('#id_protocols').find('option:selected').each(function(){ protocolsArray.push($(this).val()); }); if (protocolsArray.length == 0){ - setI18NData(errTxtEl, '2fa.no_protocol'); - errDivEl.removeClass("d-none"); + showToast('2fa.no_protocol'); return; } for (let i = 0; i < requiredProtocols.length > 0; i++){ if (!protocolsArray.includes(requiredProtocols[i])){ - setI18NData(errTxtEl, '2fa.required_protocols', {val: requiredProtocols.join(', ')}); - errDivEl.removeClass("d-none"); + showToast('2fa.required_protocols', {val: requiredProtocols.join(', ')}); return; } } @@ -563,7 +550,6 @@ explicit grant from the SFTPGo Team (support@sftpgo.com). } else { postData.enabled = true; } - errDivEl.addClass("d-none"); el.setAttribute('data-kt-indicator', 'on'); el.disabled = true; @@ -579,8 +565,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com). el.removeAttribute('data-kt-indicator'); el.disabled = false; if (!response.data.message) { - setI18NData(errTxtEl, errorMessage); - errDivEl.removeClass("d-none"); + showToast(errorMessage); return; } ModalAlert.fire({ @@ -598,8 +583,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com). }).catch(function (error) { el.removeAttribute('data-kt-indicator'); el.disabled = false; - setI18NData(errTxtEl, errorMessage); - errDivEl.removeClass("d-none"); + showToast(errorMessage); }); } diff --git a/templates/webclient/shares.html b/templates/webclient/shares.html index 8df93948..1e13b9be 100644 --- a/templates/webclient/shares.html +++ b/templates/webclient/shares.html @@ -27,7 +27,6 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).

View and manage shares

- {{- template "errmsg" ""}}
Loading... @@ -107,10 +106,6 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).