MT#21141 fix login redirect between realms

by using a relative target url (without the host part) we make sure,
that when logging in as an admin we don't get redirected to a subscriber
page or vice versa. also simplifying the login controller a bit.

Change-Id: Ib9f0cdf7c687b711f8b357816e17a175efdfd1fe
changes/58/6958/2
Gerhard Jungwirth 9 years ago
parent 36371aa446
commit 6d883c6de3

@ -1,16 +1,15 @@
package NGCP::Panel::Controller::Login;
use NGCP::Panel::Utils::Generic qw(:all);
use Moose;
use warnings;
use strict;
BEGIN { extends 'Catalyst::Controller'; }
use parent 'Catalyst::Controller';
use NGCP::Panel::Form::Login;
sub index :Path Form {
my ( $self, $c, $realm ) = @_;
$c->log->debug("*** Login::index");
$realm = 'subscriber'
unless($realm && $realm eq 'admin');
@ -77,6 +76,7 @@ sub index :Path Form {
# auth ok
my $target = $c->session->{'target'} || '/';
delete $c->session->{target};
$target =~ s!^https?://[^/]+/!/!;
$c->log->debug("*** Login::index auth ok, redirecting to $target");
$c->response->redirect($target);
return;

Loading…
Cancel
Save