From d0059b5b46bf16d5adbeddffc412699a8c815725 Mon Sep 17 00:00:00 2001 From: Edmund von der Burg Date: Thu, 7 Apr 2011 15:41:59 +0100 Subject: Add the 'remember_me' checkbox on login --- perllib/FixMyStreet/App/Controller/Auth.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'perllib/FixMyStreet/App/Controller/Auth.pm') diff --git a/perllib/FixMyStreet/App/Controller/Auth.pm b/perllib/FixMyStreet/App/Controller/Auth.pm index 16f0b994c..7526c2c25 100644 --- a/perllib/FixMyStreet/App/Controller/Auth.pm +++ b/perllib/FixMyStreet/App/Controller/Auth.pm @@ -48,8 +48,9 @@ Allow the user to legin with a username and a password. sub login : Private { my ( $self, $c ) = @_; - my $email = $c->req->param('email') || ''; - my $password = $c->req->param('password') || ''; + my $email = $c->req->param('email') || ''; + my $password = $c->req->param('password') || ''; + my $remember_me = $c->req->param('remember_me') || 0; # logout just in case $c->logout(); @@ -58,6 +59,11 @@ sub login : Private { && $password && $c->authenticate( { email => $email, password => $password } ) ) { + + # unless user asked to be remembered limit the session to browser + $c->set_session_cookie_expire(0) + unless $remember_me; + $c->res->redirect( $c->uri_for('/my') ); return; } -- cgit v1.2.3