mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 22:30:56 +03:00
WebClient: disable indicator if we redirect from the login page
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -173,6 +173,7 @@ func (s *httpdServer) renderClientLoginPage(w http.ResponseWriter, r *http.Reque
|
|||||||
CSRFToken: createCSRFToken(ip),
|
CSRFToken: createCSRFToken(ip),
|
||||||
Branding: s.binding.Branding.WebClient,
|
Branding: s.binding.Branding.WebClient,
|
||||||
FormDisabled: s.binding.isWebClientLoginFormDisabled(),
|
FormDisabled: s.binding.isWebClientLoginFormDisabled(),
|
||||||
|
CheckRedirect: true,
|
||||||
}
|
}
|
||||||
if next := r.URL.Query().Get("next"); strings.HasPrefix(next, webClientFilesPath) {
|
if next := r.URL.Query().Get("next"); strings.HasPrefix(next, webClientFilesPath) {
|
||||||
data.CurrentURL += "?next=" + url.QueryEscape(next)
|
data.CurrentURL += "?next=" + url.QueryEscape(next)
|
||||||
@@ -599,6 +600,7 @@ func (s *httpdServer) renderAdminLoginPage(w http.ResponseWriter, r *http.Reques
|
|||||||
CSRFToken: createCSRFToken(ip),
|
CSRFToken: createCSRFToken(ip),
|
||||||
Branding: s.binding.Branding.WebAdmin,
|
Branding: s.binding.Branding.WebAdmin,
|
||||||
FormDisabled: s.binding.isWebAdminLoginFormDisabled(),
|
FormDisabled: s.binding.isWebAdminLoginFormDisabled(),
|
||||||
|
CheckRedirect: false,
|
||||||
}
|
}
|
||||||
if s.binding.showClientLoginURL() {
|
if s.binding.showClientLoginURL() {
|
||||||
data.AltLoginURL = webClientLoginPath
|
data.AltLoginURL = webClientLoginPath
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ type loginPage struct {
|
|||||||
Title string
|
Title string
|
||||||
Branding UIBranding
|
Branding UIBranding
|
||||||
FormDisabled bool
|
FormDisabled bool
|
||||||
|
CheckRedirect bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type twoFactorPage struct {
|
type twoFactorPage struct {
|
||||||
|
|||||||
@@ -59,9 +59,16 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
|||||||
<script type="text/javascript" {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}}>
|
<script type="text/javascript" {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}}>
|
||||||
KTUtil.onDOMContentLoaded(function () {
|
KTUtil.onDOMContentLoaded(function () {
|
||||||
$('#sign_in_form').submit(function (event) {
|
$('#sign_in_form').submit(function (event) {
|
||||||
let submitButton = document.querySelector('#sign_in_submit');
|
let next = null;
|
||||||
submitButton.setAttribute('data-kt-indicator', 'on');
|
//{{- if .CheckRedirect}}
|
||||||
submitButton.disabled = true;
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
next = urlParams.get('next');
|
||||||
|
//{{- end}}
|
||||||
|
if (!next){
|
||||||
|
let submitButton = document.querySelector('#sign_in_submit');
|
||||||
|
submitButton.setAttribute('data-kt-indicator', 'on');
|
||||||
|
submitButton.disabled = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user