]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - html/cgi-bin/changepw.cgi
5 # This code is distributed under the terms of the GPL
7 # (c) The SmoothWall Team
9 # $Id: changepw.cgi,v 1.4.2.6 2005/03/07 21:28:03 eoberlander Exp $
14 # enable only the following on debugging purpose
16 #use CGI::Carp 'fatalsToBrowser';
18 require 'CONFIG_ROOT/general-functions.pl';
19 require "${General::swroot}/lang.pl";
20 require "${General::swroot}/header.pl";
25 &Header
::showhttpheaders
();
27 $cgiparams{'ACTION_ADMIN'} = '';
28 $cgiparams{'ACTION_DIAL'} = '';
30 &Header
::getcgihash
(\
%cgiparams);
32 if ($cgiparams{'ACTION_ADMIN'} eq $Lang::tr
{'save'})
34 my $password1 = $cgiparams{'ADMIN_PASSWORD1'};
35 my $password2 = $cgiparams{'ADMIN_PASSWORD2'};
36 if ($password1 eq $password2)
38 if ($password1 =~ m/\s|\"/) {
39 $errormessage = $Lang::tr
{'password contains illegal characters'};
41 elsif (length($password1) >= 6)
43 system('/usr/bin/htpasswd', '-m', '-b', "${General::swroot}/auth/users", 'admin', "${password1}");
44 &General
::log($Lang::tr
{'admin user password has been changed'});
47 $errormessage = $Lang::tr
{'passwords must be at least 6 characters in length'}; }
50 $errormessage = $Lang::tr
{'passwords do not match'}; }
53 if ($cgiparams{'ACTION_DIAL'} eq $Lang::tr
{'save'})
55 my $password1 = $cgiparams{'DIAL_PASSWORD1'};
56 my $password2 = $cgiparams{'DIAL_PASSWORD2'};
57 if ($password1 eq $password2)
59 if($password1 =~ m/\s|\"/) {
60 $errormessage = $Lang::tr
{'password contains illegal characters'};
62 elsif (length($password1) >= 6)
64 system('/usr/bin/htpasswd', '-b', "${General::swroot}/auth/users", 'dial', "${password1}");
65 &General
::log($Lang::tr
{'dial user password has been changed'});
68 $errormessage = $Lang::tr
{'passwords must be at least 6 characters in length'}; }
71 $errormessage = $Lang::tr
{'passwords do not match'}; }
74 &Header
::openpage
($Lang::tr
{'change passwords'}, 1, '');
76 &Header
::openbigbox
('100%', 'left', '', $errormessage);
79 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
80 print "<class name='base'>$errormessage\n";
81 print " </class>\n";
85 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
87 &Header
::openbox
('100%', 'left', $Lang::tr
{'administrator user password'});
91 <td width='20%' class='base'>$Lang::tr{'username'} 'admin'</td>
92 <td width='15%' class='base' align='right'>$Lang::tr{'password'} </td>
93 <td width='15%'><input type='password' name='ADMIN_PASSWORD1' size='10' /></td>
94 <td width='15%' class='base' align='right'>$Lang::tr{'again'} </td>
95 <td width='15%'><input type='password' name='ADMIN_PASSWORD2' size='10' /></td>
96 <td width='20%' align='center'><input type='submit' name='ACTION_ADMIN' value='$Lang::tr{'save'}' /></td>
103 &Header
::openbox
('100%', 'left', $Lang::tr
{'dial user password'});
107 <td width='20%' class='base'>$Lang::tr{'username'} 'dial'</td>
108 <td width='15%' class='base' align='right'>$Lang::tr{'password'} </td>
109 <td width='15%'><input type='password' name='DIAL_PASSWORD1' size='10'/></td>
110 <td width='15%' class='base' align='right'>$Lang::tr{'again'} </td>
111 <td width='15%'><input type='password' name='DIAL_PASSWORD2' size='10' /></td>
112 <td width='20%' align='center'><input type='submit' name='ACTION_DIAL' value='$Lang::tr{'save'}' /></td>
121 &Header
::closebigbox
();
123 &Header
::closepage
();