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 my $domain = $repo->site_domain;
23 my $subject = "[$domain] New password for user $name";
24 open (M
, '|-', 'mail', '-s', $subject, $mail)
25 or $repo->bye("Cannot spawn mail: $!");
29 Somebody requested the password for user '$name' to be reset,
30 so you are receiving the new password:
34 If you did not request the password to be reset, then we apologize.
35 In any event, you must now use this new password to change the settings
36 for the '$name' account.
38 If you would like to change your password again, you can use this quick
39 link to your account settings page:
41 http://$domain/m/edituser.cgi?name=$name
45 close M
or $repo->bye("Sending mail to $mail for $name failed: $!");
47 $user->update_password($newpwd);
49 print "<p>Account password has been reset. Have a nice day.</p>\n";
55 If you have forgotten the password for your user account,
56 it can be reset to a random string that will be mailed to your
57 registered e-mail address.
60 <input type="text" name="name" value="$name" />
61 <p><input type="submit" name="y0" value="Reset Password" /></p>