I recently developed a web application using Catalyst framework. The login page can be accessed by typing the URL:
http://mydomainname/login
When accessing this URL, the login page is displayed beautifully with all its styling from the CSS file.
However, I noticed that if I add an extra '/login' to the URL like so:
http://mydomainname/login/login
The login page still shows up, but this time without any styling applied. It seems like the CSS file is not being loaded properly.
This issue occurs whenever there are multiple 'login' keywords in the path, for example:
http://mydomainname/login/login
http://mydomainname/login/login/login/login
http://mydomainname/login/login/login/login/login
and so on...
What I want is to either disable the double 'login' paths or redirect them back to the original http://mydomainname/login
URL.
In my Login.pm Controller, the code looks like this:
sub default : Private {
my ( $self, $c ) = @_;
$c->forward('login');
}
sub login : Path('/login') {
my ( $self, $c ) = @_;
$c->stash->{title} = 'Login Page';
$c->stash->{pagetype} = "html";
$c->stash->{template} = "login.html";
}
Is this controller setup correct? And how can I prevent the issue of multiple 'login' paths from happening, such as http://mydomainname/login/login
or
http://mydomainname/login/login/login/login
?