mirror of
https://github.com/webmin/webmin.git
synced 2025-07-20 16:48:46 +00:00
URL for use in emails should use HTTP hostname if available
https://forum.virtualmin.com/t/webmin-virtualmin-password-recovery/132914/82
This commit is contained in:
@ -13106,9 +13106,23 @@ my ($mod, $cgi, $def, $forcehost) = @_;
|
||||
# Work out the base URL
|
||||
my $url;
|
||||
if (!$def && $gconfig{'webmin_email_url'}) {
|
||||
# From a config option
|
||||
$url = $gconfig{'webmin_email_url'};
|
||||
}
|
||||
elsif ($ENV{'HTTP_HOST'}) {
|
||||
# From this HTTP request
|
||||
my $host = $ENV{'HTTP_HOST'};
|
||||
my $port = $ENV{'SERVER_PORT'} || 80;
|
||||
if ($host =~ s/:(\d+)$//) {
|
||||
$port = $1;
|
||||
}
|
||||
my $proto = lc($ENV{'HTTPS'}) eq 'on' ? 'https' : 'http';
|
||||
my $defport = $proto eq 'https' ? 443 : 80;
|
||||
$url = $proto."://".$host.($port == $defport ? "" : ":".$port);
|
||||
$url .= $gconfig{'webprefix'} if ($gconfig{'webprefix'});
|
||||
}
|
||||
else {
|
||||
# Work out from miniserv config
|
||||
my %miniserv;
|
||||
&get_miniserv_config(\%miniserv);
|
||||
my $proto = $miniserv{'ssl'} ? 'https' : 'http';
|
||||
|
Reference in New Issue
Block a user