2 # (c) Petr Baudis <pasky@suse.cz>
17 substr(crypt(rand, rand), 2);
21 my $gcgi = Girocco
::CGI
->new('Forgotten Project Password');
24 my $name = $cgi->param('name');
26 unless (defined $name) {
27 print "<p>I need the project name as an argument.</p>\n";
31 if (!Girocco
::Project
::does_exist
($name,1) && !Girocco
::Project
::valid_name
($name)) {
32 print "<p>Invalid project name. Go away, sorcerer.</p>\n";
36 if (!Girocco
::Project
::does_exist
($name,1)) {
37 print "<p>Sorry but this project does not exist. Now, how did you <em>get</em> here?!</p>\n";
41 my $proj = Girocco
::Project
->load($name);
42 $proj or die "not found project $name, that's really weird!";
44 my $mail = $proj->{email
};
46 my $y0 = $cgi->param('y0') || '';
47 if ($y0 eq 'Reset Password' && $cgi->request_method eq 'POST') {
50 my $newpwd = genpwd
();
52 open (M
, '|-', 'mail', '-s', "[$Girocco::Config::name] New password for project $name", $mail) or die "Cannot spawn mail: $!";
56 somebody asked for the password for project $name to be reset. Since you are
57 the project admin, you get to know the new password:
61 In case you did not request the password to be reset, we apologize. Nevertheless,
62 you have to use the reset password now (possibly to change it back).
64 Quick-link to the edit project page:
66 $Girocco::Config::webadmurl/editproj.cgi?name=$name
70 close M
or die "mail $mail for $name died? $!";
72 $proj->update_password($newpwd);
74 print "<p>Project password has been reset. Have a nice day.</p>\n";
79 <p>You are trying to make me reset password for project $name. I will send the new
80 password to the project admin <$mail>.</p>
81 <form method="post" action="@{[url_path($Girocco::Config::webadmurl)]}/pwproj.cgi">
82 <input type="hidden" name="name" value="$name" />
83 <p><input type="submit" name="y0" value="Reset Password" /></p>