Author: rob Date: 2010-07-06 07:27:55 +0000 (Tue, 06 Jul 2010) New Revision: 22485
You can view the changes in this commit at: https://svn.nixos.org/viewvc/nix?rev=22485&view=rev Modified: hydra/trunk/src/lib/Hydra/Controller/Root.pm Log: Hydra/33: 'Sign in' should return to the referring page Changes: Modified: hydra/trunk/src/lib/Hydra/Controller/Root.pm =================================================================== --- hydra/trunk/src/lib/Hydra/Controller/Root.pm 2010-07-06 07:25:07 UTC (rev 22484) +++ hydra/trunk/src/lib/Hydra/Controller/Root.pm 2010-07-06 07:27:55 UTC (rev 22485) @@ -37,12 +37,19 @@ my $username = $c->request->params->{username} || ""; my $password = $c->request->params->{password} || ""; + if(! $username && ! defined $c->flash->{afterLogin}) { + my $baseurl = $c->uri_for('/'); + my $refurl = $c->request->referer; + $c->flash->{afterLogin} = $refurl if $refurl =~ m/^($baseurl)/ ; + } + if ($username && $password) { if ($c->authenticate({username => $username, password => $password})) { $c->response->redirect( defined $c->flash->{afterLogin} ? $c->flash->{afterLogin} : $c->uri_for('/')); + $c->flash->{afterLogin} = undef; return; } $c->stash->{errorMsg} = "Bad username or password."; _______________________________________________ nix-commits mailing list [email protected] http://mail.cs.uu.nl/mailman/listinfo/nix-commits
