Cart now redirects to ssl if the site is ssl enabled.
This commit is contained in:
parent
026e77663e
commit
eff953b5ed
3 changed files with 43 additions and 1 deletions
|
|
@ -241,6 +241,43 @@ sub getRefererUrl {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 forceSecureConnection( url )
|
||||
|
||||
Attempts to create an SSL connection with the current or passed in url.
|
||||
|
||||
=head3 url
|
||||
|
||||
The optional url that the page should forward to as an SSL connection.
|
||||
|
||||
=cut
|
||||
|
||||
sub forceSecureConnection{
|
||||
my $self = shift;
|
||||
my $url = shift;
|
||||
my ($conf, $env, $http) = $self->session->quick(qw(config env http));
|
||||
|
||||
if ($conf->get("sslEnabled") && $env->get("HTTPS") ne "on" && !$env->get("SSLPROXY")){
|
||||
|
||||
$url = $self->session->url->page if(! $url);
|
||||
$url = $self->session->env->get('QUERY_STRING') if(! $url);
|
||||
|
||||
if($url !~ /^$self->getSiteURL()/i){
|
||||
$url = $self->getSiteURL() . $url;
|
||||
}
|
||||
if($env->get('QUERY_STRING')){
|
||||
$url .= "?". $env->get('QUERY_STRING');
|
||||
}
|
||||
if($url =~ /^http/i) {
|
||||
$url =~ s/^https?/https/i;
|
||||
$http->setRedirect($url);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -678,7 +678,10 @@ sub www_view {
|
|||
my $url = $session->url;
|
||||
my $i18n = WebGUI::International->new($session, "Shop");
|
||||
my @items = ();
|
||||
|
||||
|
||||
if($url->forceSecureConnection()){
|
||||
return "redirect";
|
||||
}
|
||||
# set up html header
|
||||
$session->style->setRawHeadTags(q|
|
||||
<script type="text/javascript">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue