2 # (c) Zachary T Welch <zw@superlucidity.net>
3 # (c) Petr Baudis <pasky@suse.cz>
9 use lib
qw(/home/repo/repomgr/cgi);
12 my $repo = Git
::RepoCGI
->new('Forgotten User Password');
14 my $name = $repo->sparam('name');
15 my $user = Git
::RepoCGI
::User
->load($name);
16 my $mail = $user->{email
};
18 if ($repo->sparam('y0')) {
20 my $newpwd = genpwd
();
22 # TODO: get hard-coded domain name from a config file
23 my $domain = 'repo.or.cz';
24 my $subject = "[$domain] New password for user $name";
25 open (M
, '|-', 'mail', '-s', $subject, $mail)
26 or $repo->bye("Cannot spawn mail: $!");
30 Somebody requested the password for user '$name' to be reset,
31 so you are receiving the new password:
35 If you did not request the password to be reset, then we apologize.
36 In any event, you must now use this new password to change the settings
37 for the '$name' account.
39 If you would like to change your password again, you can use this quick
40 link to your account settings page:
42 http://repo.or.cz/m/edituser.cgi?name=$name
46 close M
or $repo->bye("Sending mail to $mail for $name failed: $!");
48 $user->update_password($newpwd);
50 print "<p>Account password has been reset. Have a nice day.</p>\n";
56 If you have forgotten the password for your user account,
57 it can be reset to a random string that will be mailed to your
58 registered e-mail address.
61 <input type="text" name="name" value="$name" />
62 <p><input type="submit" name="y0" value="Reset Password" /></p>