<!--
Copyright (C) 2023 Nicola Murino

This WebUI uses the KeenThemes Bootstrap Templates:

https://keenthemes.com/bootstrap-templates

KeenThemes HTML/CSS/JS components are allowed for use only within the
SFTPGo product and restricted to be used in a resealable HTML template
that can compete with KeenThemes products anyhow.

This WebUI is allowed for use only within the SFTPGo product and
therefore cannot be used in derivative works/products without an
explicit grant from the SFTPGo Team (support@sftpgo.com).
-->
{{- define "baselogin"}}
<!DOCTYPE html>
<html lang="en">
    <head>
		<title></title>
		<meta charset="utf-8" />
		<meta name="description" content="" />
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<meta name="robots" content="noindex">
		<link rel="icon" type="image/png" href="{{.StaticURL}}{{.Branding.FaviconPath}}" />
		{{- template "fonts" . }}
		{{- range .Branding.DefaultCSS}}
    	<link href="{{$.StaticURL}}{{.}}" rel="stylesheet" type="text/css">
    	{{- end}}
		{{- template "globalstyle" .CSPNonce }}
        {{- range .Branding.ExtraCSS}}
    	<link href="{{$.StaticURL}}{{.}}" rel="stylesheet" type="text/css">
    	{{- end}}
		{{- template "commonjs" .CSPNonce}}
	</head>

    <body class="app-blank">
        {{- template "theme-setup" .CSPNonce}}
		<div id="app_loader" class="align-items-center text-center my-10">
            <span class="spinner-border w-15px h-15px text-muted align-middle me-2"></span>
        </div>
        <div class="d-flex flex-column flex-root d-none" id="app_root">
			<div class="d-flex flex-column flex-column-fluid bgi-position-y-bottom position-x-center bgi-no-repeat bgi-size-contain bgi-attachment-fixed">
				<div class="d-flex flex-center flex-column flex-column-fluid p-10 pb-lg-20">
					<div class="w-lg-500px w-md-450px w-sm-400px bg-body rounded shadow-sm p-10 p-lg-15 mx-auto">
                        {{template "content" .}}
					</div>
				</div>
			</div>
		</div>
		<script {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}} src="{{.StaticURL}}/assets/plugins/global/plugins.bundle.js"></script>
		<script {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}} src="{{.StaticURL}}/assets/js/scripts.bundle.js"></script>
		<script {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}} src="{{.StaticURL}}/vendor/i18next/i18next.min.js"></script>
		<script {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}} src="{{.StaticURL}}/vendor/i18next/jquery-i18next.min.js"></script>
		<script {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}} src="{{.StaticURL}}/vendor/i18next/i18nextBrowserLanguageDetector.min.js"></script>
		<script {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}} src="{{.StaticURL}}/vendor/i18next/i18nextChainedBackend.min.js"></script>
        <script {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}} src="{{.StaticURL}}/vendor/i18next/i18nextLocalStorageBackend.min.js"></script>
		<script {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}} src="{{.StaticURL}}/vendor/i18next/i18nextHttpBackend.min.js"></script>
		{{- template "basejs" . }}
		<script type="text/javascript" {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}}>
			KTUtil.onDOMContentLoaded(function () {
				$('#sign_in_form').submit(function (event) {
					let next = null;
					//{{- if .CheckRedirect}}
					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>
    </body>
</html>
{{- end}}
