-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.cgi
executable file
·66 lines (54 loc) · 2.03 KB
/
index.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/local/bin/perl
# Show a page for Virtualmin domain owners or Cloudmin system owners to use to
# retrieve their lost passwords via email.
use strict;
use warnings;
our (%text, %config);
our ($has_virt, $has_vm2);
our $module_name;
our $trust_unknown_referers = 1;
require './password-recovery-lib.pl';
my $sfx = $has_virt && $has_vm2 ? "3" : $has_vm2 ? "2" : "";
if (!$ENV{"ANONYMOUS_USER"}) {
# Being accessed non-anonymously .. tell the admin
&ui_print_header(undef, $text{'index_title'.$sfx}, "", undef, 1, 1);
my $url = uc($ENV{'HTTPS'}) eq "ON" ? "https" : "http";
$url .= "://$ENV{'SERVER_NAME'}:$ENV{'SERVER_PORT'}";
$url .= "/$module_name/";
print "<p>",&text('index_usage', "<a href='$url'>$url</a>"),"</p>\n";
# Show form for editing email
print "<hr>\n";
print &ui_subheading($text{'index_emailheader'});
print $text{'index_emaildesc'},"<p>\n";
print &ui_form_start("save_email.cgi", "form-data");
my $email = &get_custom_email();
print &ui_radio("email_def", $email ? 0 : 1,
[ [ 1, $text{'index_emaildef'} ],
[ 0, $text{'index_emailset'} ] ]),"<br>\n";
print &ui_textarea("email", $email, 10, 70);
print &ui_form_end([ [ "save", $text{'save'} ] ]);
&ui_print_footer("/", $text{'index'});
}
else {
# Show recovery form
&popup_header($text{'index_title'});
print "<center><h1>",$text{'index_title'.$sfx},"</h1></center>\n";
print $text{'index_desc'.$sfx},"<p>\n";
print &ui_form_start("email.cgi", "post");
print &ui_table_start($text{'index_header'}, undef, 2);
# Username or domain name
print &ui_table_row($text{'index_user'.$sfx},
&ui_textbox("user", undef, 30));
print &ui_table_row(" ", $text{'index_or'});
print &ui_table_row($text{'index_dom'.$sfx},
&ui_textbox("dom", undef, 60));
# Reset method (if allowed)
if ($config{'mode'} == 0) {
print &ui_table_row($text{'index_mode'},
&ui_radio("mode", 1, [ [ 1, $text{'index_mode1'} ],
[ 2, $text{'index_mode2'} ] ]));
}
print &ui_table_end();
print &ui_form_end([ [ undef, $text{'index_submit'} ] ]);
&popup_footer();
}