<!DOCTYPE html>
<html lang="en" class="auth-body">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="cache-control" content="max-age=0">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT">
		<meta http-equiv="pragma" content="no-cache">

		<link rel="stylesheet" type="text/css" href="/p.css"/>
		<title th:text="#{login.title}">Login</title>

		<!-- [[#{login.error.usernameRequired}]] -->

		<script type="text/javascript" th:utext="${_labels}">
			/* TODO */
			window.__labels = [];
			window.__labels['UsernameRequired'] = "Vyplňte prosím e-mail";
			window.__labels['PasswordRequired'] = "Vyplňte prosím heslo";
			window.__labels['UnexpectedError'] = "Došlo k neočekávané chybě";
			window.__labels['UsernameTaken'] = "Uživatel již existuje. Zvolte prosím jiný e-mail";
			window.__labels['BadUsername'] = "Neplatný e-mail";
			window.__labels['BadPassword'] = "Neplatné heslo";
			window.__labels['BadUsernameOrPassword'] = "Neplatný e-mail nebo heslo";
			window.__labels['ResetTokenSent'] = "Na emailovou adresu byl zaslán postup pro obnovení hesla";
		</script>
	</head>

	<body class="auth-body">

		<div class="auth-page">
		  <div class="auth-form">
		  	<h1 class="small" th:text="#{login.title}">Login</h1>
      		<div id="loginError" class="auth-form-field-error" style="display:none;"></div>
		    <form id="loginForm">
		    	<div id="loginErrorId"></div>
		    	<div class="auth-form-input">
		      		<input id="loginUsername" type="text" placeholder="username (email)" th:placeholder="#{login.login}"/>
		      		<div id="loginUsernameError" class="auth-form-field-error"></div>
		      	</div>
		      	<div class="auth-form-input">
		      		<input id="loginPassword" type="password" placeholder="password" th:placeholder="#{login.password}"/>
		      		<div id="loginPasswordError" class="auth-form-field-error"></div>
		      	</div>
		      	<div class="auth-button-container">
		      		<button id="loginButton" th:text="#{login.loginAction}">Login</button>
		      		<div id="authActivityIndicator" class="activity-indicator-container" style="display:none;">
		      			<div class="ball-pulse">
		      				<div></div>
		      				<div></div>
		      				<div></div>
		      			</div>
		      		</div>
		      	</div>
		      	<div>
		      		<p class="message">	
						<a href="/auth/reset" id="resetLink" th:text="#{login.resetLink}">Having trouble logging in?</a>
					</p>
		      	</div>
		    </form>
		  </div>
		</div>

		<script type="text/javascript" src="/utils.js"></script>
		<script type="text/javascript" src="/auth/login.js"></script>

		<script defer="defer">
			(function() {

				login.form({
					formId: "loginForm",
					usernameId: "loginUsername",
					passwordId: "loginPassword",
					loginTargetUri: "[[${loginTargetUri}]]",
					resetTargetUri: "[[${resetTargetUri}]]"
				});

			})();
		</script>
	</body>
</html>