{% extends 'layouts/layoutAuth.twig' %}

{% block title %}{{ translate('Login') }}{% endblock %}

{% block content %}

	<div class="flex flex-col-reverse min-h-screen justify-end {{ authpagestacked ? '' : 'lg:flex-row lg:min-h-0' }}">
		
		<div class="flex-1 flex justify-center items-center {{ authpagestacked ? 'w-full' : 'lg:w-1/2 lg:flex-none lg:min-h-screen' }}" style="background-color: {{ authpagebgcolor|default('#0d9488') }}; color: {{ authpagetextcolor|default('#ffffff') }};">
			<div class="max-w-md content-center">
			
				<form method="POST" action="{{ url_for("auth.login") }}" autocomplete="off">
				
					<fieldset class="">

						<div class="my-2 {{ errors.username ? ' errors' : '' }}">
							<label for="username">{{ translate('Username') }} <abbr title="{{ translate('required') }}">*</abbr></label>
							<input 
								id="username"
								type="text" 
								name="username" 
								value="{{ old.username|e }}" 
								class="form-control block w-full px-3 py-1.5 text-base font-normal text-gray-700 bg-white bg-clip-padding border border-solid border-gray-300 transition ease-in-out m-0 focus:text-gray-700 focus:bg-white focus:border-blue-600 focus:outline-none"
							required>
							{% if errors.signup_username %}
								<span class="">{{ errors.username|first }}</span>
							{% endif %}
						</div>
						
						<div class="my-2 {{ errors.password ? ' errors' : '' }}">
							<label for="password">{{ translate('Password') }} <abbr title="{{ translate('required') }}">*</abbr></label>
							<input 
								id="password"
								type="password" 
								name="password" 
								autocomplete="off"
								class="form-control block w-full px-3 py-1.5 text-base font-normal text-gray-700 bg-white bg-clip-padding border border-solid border-gray-300 transition ease-in-out m-0 focus:text-gray-700 focus:bg-white focus:border-blue-600 focus:outline-none"
							required>
							{% if errors.password %}
								<span class="error">{{ errors.password|first }}</span>
							{% endif %}
						</div>

						<div class="personal-mail hidden" style="display:none">
							<label>Personal Mail</label>
							<input type="text" name="personal-honey-mail">
						</div>

						{% if captcha == 'standard' %}
							
							{{ captcha(true) }}
						
						{% elseif captcha == 'aftererror' %}

							{{ captcha(old) }}

						{% else %}

							{{ clearcaptcha() }}
						
						{% endif %}

						<input 
							type="submit" 
							value="{{ translate('Login') }}" 
							style="color: {{ authpagetextcolor|default('#ffffff') }}; border-color: {{ authpagetextcolor|default('#ffffff') }};"
                       		class="block w-full mt-6 px-3 py-3 border-0 font-medium text-xs leading-tight uppercase border-2 pointer auth-btn cursor-pointer focus:outline-none focus:ring-0 transition duration-100 ease-in-out"
						/>

						{% if recover %}
							<div class="text-center py-4">
								<a class="hover:underline" href="{{ url_for("auth.recover") }}">{{ translate('forgot password') }}</a>
							</div>
						{% endif %}

					</fieldset>

				</form>	
			</div>
		</div>
		
		<div class="p-5 border-b border-white content-center flex justify-center items-center auth-right-side {{ authpagestacked ? 'w-full' : 'lg:w-1/2' }}">
			<div class="max-w-md content-center {{ authpagestacked ? 'text-center' : '' }}">
				{% if authpagerightcontent %}
					{{ markdown(authpagerightcontent) }}
				{% else %}
				<h1 class="text-4xl py-5">{{ translate('Welcome back') }}</h1>
				<p>{{ translate('Login to the author area or go to the') }} <a class="underline" href="{{ url_for('home')}}">{{ translate('homepage') }}</a></p>
				{% endif %}
			</div>
		</div>
	
	</div>
{% endblock %}
