[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: How to enable user to change their own password

From: Jonathan Coles <jcoles0727_at_rogers.com>
Date: 2005-07-21 02:42:43 CEST

I use a Perl script. It runs in a ScriptAlias location that requires
so I know who is calling the script. It then uses the Apache htpasswd
to change the password with the command:

/usr/local/apache2/bin/htpasswd -bm /home/svn/users $username $newpasswd 2

/home/svn/users is my password file. Passwords use MD5 encryption.

Here is the entire script. I am new to Perl, so I would not be surprised
if people here find flaws or suggest improvements to it:

#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);
print header;
print "<html><head>";
print "<title>Change password</title>";
print "</head><body>";
print "<FORM action=chpasswd.cgi method=GET>";
print "<table><tr><td>New password: </td>";
print "<td><input name=newpasswd type=password></td></tr>";
print "<tr><td>Confirm:</td>";
print "<td><input name=confirmpasswd type=password></td></tr>";
print "<tr><td></td><td align=center><input type=submit value='Change
print "</FORM>";

my $username=$ENV{REMOTE_USER};
my $newpasswd = param('newpasswd');
if ($newpasswd ne undef) {
    my $confirmpasswd = param('confirmpasswd');
    if ($newpasswd eq $confirmpasswd) {
        print "<pre>";
        system ("/usr/local/apache2/bin/htpasswd -bm /home/svn/users
$username $newpasswd 2> /home/svn/result && cat /home/svn/result");
        print "</pre>";
    else { print "<p>Confirmation doesn't match password. Try again.</p>"; }
else {print "<br>";}
print "<p><a href=>Return</a></p>";
print "</body></html>\n";

Calvin wrote:

>Is there anyway to do this?
>I am using Apache, auth_svn_mod.
>To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
>For additional commands, e-mail: users-help@subversion.tigris.org

To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Jul 21 02:45:10 2005

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.