1#!/usr/local/bin/perl
2# index.cgi
3# Display a form for choosing a new password
4
5require './changepass-lib.pl';
6&ReadParse();
7&ui_print_header(undef, $text{'index_title'}, "", undef, 0, 1);
8
9# Start of tabs
10my @tabs = ( [ 'pass', $text{'index_passtab'} ],
11	     [ 'recovery', $text{'index_recoverytab'} ] );
12print ui_tabs_start(\@tabs, 'mode', $in{'mode'} || 'pass', 1);
13
14# Password change form
15print &ui_tabs_start_tab("mode", "pass");
16print "$text{'index_desc1a'}<br>\n";
17print "$text{'index_desc2'}<br>\n" if (&has_command($config{'smbpasswd'}));
18print "<p>\n";
19
20print &ui_form_start("changepass.cgi", "post");
21print &ui_table_start(undef, undef, 2);
22
23# Username and real name
24print &ui_table_row($text{'index_for'},
25	"<tt>$remote_user</tt>".
26	($remote_user_info[6] ? " ($remote_user_info[6])" : ""));
27
28# Old password
29print &ui_table_row($text{'index_old'},
30	&ui_password("old", undef, 20));
31
32# New password twice
33print &ui_table_row($text{'index_new1'},
34	&ui_password("new1", undef, 20));
35print &ui_table_row($text{'index_new2'},
36	&ui_password("new2", undef, 20));
37
38print &ui_table_end();
39print &ui_form_end([ [ undef, $text{'index_change'} ] ]);
40print &ui_tabs_end_tab("mode", "pass");
41
42# Start of recovery address form
43print &ui_tabs_start_tab("mode", "recovery");
44
45print "$text{'index_desc3'}<p>\n";
46print &ui_form_start("recovery.cgi", "post");
47print &ui_table_start(undef, undef, 2);
48
49$recovery = &get_recovery_address();
50print &ui_table_row($text{'index_recovery'},
51	&ui_radio("recovery_def", $recovery ? 0 : 1,
52		  [ [ 1, $text{'index_recoverydef'} ],
53		    [ 0, $text{'index_recoverysel'}." ".
54			 &ui_textbox("recovery", $recovery, 60) ] ]));
55
56print &ui_table_end();
57print &ui_form_end([ [ undef, $text{'save'} ] ]);
58print &ui_tabs_end_tab("mode", "recovery");
59
60print ui_tabs_end(1);
61
62&ui_print_footer("/", $text{'index'});
63
64