% if (my $user = current_user()) {
	<div class="row">
		<div class="col s12">
			<div class="card grey darken-4">
				<div class="card-content white-text">
					<span class="card-title">Hallo, <%= $user->{name} %>!</span>
					<p>
						Du bist bereits angemeldet. Falls du mehrere Accounts hast
						und auf einen anderen wechseln möchtest, musst du dich
						vorher
						%= form_for 'logout' => begin
							%= csrf_field
							<button class="btn waves-effect waves-light" type="submit" name="action" value="logout">
								Abmelden
							</button>
						%= end
					</p>
				</div>
			</div>
		</div>
	</div>
% }
% if (my $invalid = stash('invalid')) {
	%= include '_invalid_input', invalid => $invalid
% }
% if (my $from = stash('from')) {
	<div class="row">
		<div class="col s12">
			% if ($from eq 'register') {
				<div class="card grey darken-4">
					<div class="card-content white-text">
						<span class="card-title">Bitte warten</span>
						<p>Ein Verifizierungslink wurde an die von dir angegebene
						Mail-Adresse geschickt. Sobald du diesen angeklickt hast,
						kannst du dich hier anmelden.</p>
					</div>
				</div>
			% }
			% elsif ($from eq 'verification') {
				<div class="card green darken-4">
					<div class="card-content white-text">
						<span class="card-title">Account freigeschaltet</span>
						<p>Du kannst dich nun anmelden.</p>
					</div>
				</div>
			% }
		</div>
	</div>
% }
%= form_for '/login' => (method => 'POST') => begin
	%= csrf_field
	% if (stash('redirect_to')) {
		%= hidden_field 'redirect_to' => stash('redirect_to')
	% }
	<div class="row">
		<div class="input-field col s12">
			<i class="material-icons prefix">account_circle</i>
			%= text_field 'user', id => 'user', class => 'validate', required => undef, maxlength => 60, autocomplete => 'username'
			<label for="user">Account</label>
		</div>
		<div class="input-field col s12">
			<i class="material-icons prefix">lock</i>
			%= password_field 'password', id => 'password', class => 'validate', required => undef, autocomplete => 'current-password'
			<label for="password">Passwort</label>
		</div>
	</div>
	<div class="row">
		<div class="col s3 m3 l3">
		</div>
		<div class="col s6 m6 l6 center-align">
			<button class="btn waves-effect waves-light" type="submit" name="action" value="login">
				Anmelden
				<i class="material-icons right">send</i>
			</button>
		</div>
		<div class="col s3 m3 l3">
		</div>
	</div>
	<div class="row" style="margin-top: 2em;">
		<div class="col s3 m3 l3">
		</div>
		<div class="col s6 m6 l6 center-align">
			<a href="/recover">
				Passwort vergessen
			</a>
		</div>
		<div class="col s3 m3 l3">
		</div>
	</div>
%= end

%= include '_footer', version => stash('version')
