From 6d883c6de31e7af40cc07bc5eea30e27014ad4fd Mon Sep 17 00:00:00 2001 From: Gerhard Jungwirth Date: Mon, 11 Jul 2016 10:01:29 +0200 Subject: [PATCH] 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 --- lib/NGCP/Panel/Controller/Login.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/NGCP/Panel/Controller/Login.pm b/lib/NGCP/Panel/Controller/Login.pm index 7ac5f0dcee..1b9f91db82 100644 --- a/lib/NGCP/Panel/Controller/Login.pm +++ b/lib/NGCP/Panel/Controller/Login.pm @@ -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;