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 Project Password');
13 my $name = $repo->sparam('name');
14 my $proj = $repo->load_project($name);
16 my $mail = $proj->{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 project $name";
25 open (M
, '|-', 'mail', '-s', $subject, $mail)
26 or $repo->bye("Cannot spawn mail: $!");
30 Somebody requested the password for project '$name.git' to be reset.
32 This address has been listed as the contact address for the project,
33 so you are receiving the new password:
37 If you did not request the password to be reset, then we apologize.
38 In any event, you must now use this new password to change the settings
39 for the '$name.git' project.
41 If you would like to change your project password again, you can use
42 this quick link to edit the project page:
44 Quick-link to the edit project page:
46 http://repo.or.cz/m/editproj.cgi?name=$name
50 close M
or $repo->bye("Sending mail to $mail for $name failed: $!");
52 $proj->update_password($newpwd);
54 print "<p>Project password has been reset. Have a nice day.</p>\n";
59 <p>If you have forgotten the admin password for the '$name' project,
60 it can be reset to a random string that will be mailed to the listed
61 contact e-mail address: <tt><$mail></tt>.</p>
63 <input type="hidden" name="name" value="$name" />
64 <p><input type="submit" name="y0" value="Reset Password" /></p>