Skip to content

Commit 5314530

Browse files
committedOct 6, 2011
When using encrypted logins, do not add the webServerPort from the config file. Fixes bug #12269.
1 parent e5ef40f commit 5314530

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed
 

‎docs/changelog/7.x.x.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
- fixed #12256: Calendar Search doesn't show admin controls
33
- fixed #12268: Point of sale form missing from cart screen.
44
- fixed #12201: AssetReport - no selects.
5+
- fixed #12269: Login / Loginbox with encryptlogin
56

67
7.10.23
78
- fixed #12225: Stock asset, multiple instances on a page

‎lib/WebGUI/Auth.pm

+8-5
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,10 @@ sub displayLogin {
590590
$vars->{title} = $i18n->get(66);
591591
my $action;
592592
if ($self->session->setting->get("encryptLogin")) {
593-
$action = $self->session->url->page(undef,1);
594-
$action =~ s/http:/https:/;
593+
my $uri = URI->new($session->url->page(undef,1));
594+
$uri->scheme('https');
595+
$uri->host_port($uri->host);
596+
$action = $uri->as_string;
595597
}
596598
$vars->{'login.form.header'} = WebGUI::Form::formHeader($self->session,{action=>$action});
597599
$vars->{'login.form.hidden'} = WebGUI::Form::hidden($self->session,{"name"=>"op","value"=>"auth"});
@@ -923,9 +925,10 @@ sub login {
923925
$self->session->scratch->delete("redirectAfterLogin");
924926
}
925927
elsif ($self->session->setting->get('encryptLogin')) {
926-
my $currentUrl = $self->session->url->page(undef,1);
927-
$currentUrl =~ s/^https:/http:/;
928-
$self->session->http->setRedirect($currentUrl);
928+
my $currentUrl = URI->new($self->session->url->page(undef,1));
929+
$currentUrl->scheme('http');
930+
$currentUrl->port($self->session->config->get('webServerPort') || 80);
931+
$self->session->http->setRedirect($currentUrl->canonical->as-string);
929932
}
930933

931934
# Get open version tag. This is needed if we want

‎lib/WebGUI/Macro/L_loginBox.pm

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use strict;
1414
use WebGUI::Form;
1515
use WebGUI::International;
1616
use WebGUI::Asset::Template;
17+
use URI;
1718

1819
=head1 NAME
1920
@@ -96,8 +97,10 @@ sub process {
9697

9798
my $action;
9899
if ($session->setting->get("encryptLogin")) {
99-
$action = $session->url->page(undef,1);
100-
$action =~ s/http:/https:/;
100+
my $uri = URI->new($session->url->page(undef,1));
101+
$uri->scheme('https');
102+
$uri->host_port($uri->host);
103+
$action = $uri->canonical->as_string;
101104
}
102105
$var{'form.header'} = WebGUI::Form::formHeader($session,{action=>$action})
103106
.WebGUI::Form::hidden($session,{

‎t/Macro/L_loginBox.t

+7-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ $session->{_env}->{_env} = \%newEnvHash;
3838

3939
my $i18n = WebGUI::International->new($session,'Macro_L_loginBox');
4040

41-
plan tests => 30;
41+
plan tests => 31;
4242

4343
my $output = WebGUI::Macro::L_loginBox::process($session,'','',$template->getId);
4444
my %vars = simpleTextParser($output);
@@ -155,6 +155,12 @@ $output = WebGUI::Macro::L_loginBox::process($session,'','',$template->getId);
155155
%vars = simpleTextParser($output);
156156
like($vars{'form.header'}, qr{https://}, 'form.header action set to use SSL by encryptLogin');
157157

158+
WebGUI::Test->originalConfig('webServerPort');
159+
$session->config->set('webServerPort', 8081);
160+
$output = WebGUI::Macro::L_loginBox::process($session,'','',$template->getId);
161+
%vars = simpleTextParser($output);
162+
unlike($vars{'form.header'}, qr{:8081}, '... when setting, remove the port');
163+
158164
##Finally, a test that the default Template exists
159165

160166
$output = WebGUI::Macro::L_loginBox::process($session,'','','');

0 commit comments

Comments
 (0)
Please sign in to comment.