mirror of
https://github.com/webmin/webmin.git
synced 2025-08-19 01:15:14 +00:00
Define the forgot password dir in init_config
This commit is contained in:
@ -8,14 +8,13 @@ $trust_unknown_referers = 1;
|
||||
&init_config();
|
||||
&ReadParse();
|
||||
$gconfig{'forgot_pass'} || &error($text{'forgot_ecannot'});
|
||||
my $forgot_password_link_dir = "$config_directory/forgot-password";
|
||||
my $forgot_timeout = 10;
|
||||
&error_setup($text{'forgot_err'});
|
||||
|
||||
# Check that the random ID is valid
|
||||
$in{'id'} =~ /^[a-f0-9]+$/i || &error($text{'forgot_eid'});
|
||||
my %link;
|
||||
&read_file("$forgot_password_link_dir/$in{'id'}", \%link) ||
|
||||
&read_file("$main::forgot_password_link_dir/$in{'id'}", \%link) ||
|
||||
&error($text{'forgot_eid2'});
|
||||
time() - $link{'time'} > 60*$forgot_timeout &&
|
||||
&error(&text('forgot_etime', $forgot_timeout));
|
||||
@ -104,7 +103,7 @@ if (defined($in{'newpass'})) {
|
||||
}
|
||||
print &text('forgot_retry', '/'),"<p>\n";
|
||||
|
||||
&unlink_file("$forgot_password_link_dir/$in{'id'}");
|
||||
&unlink_file("$main::forgot_password_link_dir/$in{'id'}");
|
||||
}
|
||||
else {
|
||||
# Show password selection form
|
||||
|
@ -7,7 +7,6 @@ $no_acl_check++;
|
||||
&init_config();
|
||||
&ReadParse();
|
||||
$gconfig{'forgot_pass'} || &error($text{'forgot_ecannot'});
|
||||
$forgot_password_link_dir = "$config_directory/forgot-password";
|
||||
|
||||
# Lookup the Webmin user
|
||||
&foreign_require("acl");
|
||||
@ -25,8 +24,8 @@ my %link = ( 'id' => &generate_random_id(),
|
||||
'time' => time(),
|
||||
'user' => $wuser->{'name'} );
|
||||
$link{'id'} || &error($text{'forgot_erandom'});
|
||||
&make_dir($forgot_password_link_dir, 0700);
|
||||
&write_file("$forgot_password_link_dir/$link{'id'}", \%link);
|
||||
&make_dir($main::forgot_password_link_dir, 0700);
|
||||
&write_file("$main::forgot_password_link_dir/$link{'id'}", \%link);
|
||||
my $baseurl = &get_webmin_email_url();
|
||||
my $url = $baseurl.'/forgot.cgi?id='.&urlize($link{'id'});
|
||||
|
||||
|
@ -5218,6 +5218,7 @@ else {
|
||||
}
|
||||
$main::http_cache_directory = $ENV{'WEBMIN_VAR'}."/cache";
|
||||
$main::default_debug_log_file = $ENV{'WEBMIN_VAR'}."/webmin.debug";
|
||||
$main::forgot_password_link_dir = $ENV{'WEBMIN_VAR'}."/forgot-password";
|
||||
|
||||
if ($ENV{'SESSION_ID'}) {
|
||||
# Hide this variable from called programs, but keep it for internal use
|
||||
|
Reference in New Issue
Block a user