Remember user name

Change-Id: Ibccc786cd513510b08582e89605e74c02d8fceab
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index 1348219..2db406a 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -9,6 +9,7 @@
 # Minor version - may be patched from package.json
 our $VERSION = '0.21';
 
+# TODO: Use CSRF!!!
 # TODO: The FAQ-Page has a contact form for new questions
 # TODO: Embed query serialization
 # TODO: Embed collection statistics
diff --git a/lib/Kalamar/Controller/User.pm b/lib/Kalamar/Controller/User.pm
index de47390..b80aec0 100644
--- a/lib/Kalamar/Controller/User.pm
+++ b/lib/Kalamar/Controller/User.pm
@@ -22,6 +22,9 @@
     $c->notify(success => 'Login successful!');
   };
 
+  # Set flash for redirect
+  $c->flash(handle_or_email => $v->param('handle_or_email'));
+
   # Redirect to slash
   return $c->redirect_to('/');
 };
diff --git a/t/remote_user.t b/t/remote_user.t
index ac81b5c..1942158 100644
--- a/t/remote_user.t
+++ b/t/remote_user.t
@@ -15,8 +15,6 @@
 #$t->post_ok('/user/login' => form => { handle_or_email => 'test' })
 #  ->status_is(302);
 
-# TODO: Use csrf!!!
-
 $t->post_ok('/user/login' => form => { handle_or_email => 'test', pwd => 'fail' })
   ->status_is(302)
   ->header_is('Location' => '/');
@@ -24,9 +22,10 @@
 $t->get_ok('/')
   ->status_is(200)
   ->element_exists('div.notify-error')
-  # ->element_exists('input[name=handle_or_email][value=test]')
+  ->element_exists('input[name=handle_or_email][value=test]')
   ;
 
+
 done_testing;
 __END__
 
diff --git a/templates/layouts/main.html.ep b/templates/layouts/main.html.ep
index 0b68f9f..519229e 100644
--- a/templates/layouts/main.html.ep
+++ b/templates/layouts/main.html.ep
@@ -25,6 +25,9 @@
 
 % unless (user_auth) { # user not logged in
 % content_for 'sidebar', begin
+% if (flash('handle_or_email') && !param('handle_or_email')) {
+%   param(handle_or_email => flash('handle_or_email'));
+% };
 <fieldset>
   %= form_for 'login', begin
   <legend><span><%= loc 'login' %></span></legend>