| 1 | ############################################################################## | ||
| 2 | # The Faq-O-Matic is Copyright 1997 by Jon Howell, all rights reserved. # | ||
| 3 | # # | ||
| 4 | # This program is free software; you can redistribute it and/or # | ||
| 5 | # modify it under the terms of the GNU General Public License # | ||
| 6 | # as published by the Free Software Foundation; either version 2 # | ||
| 7 | # of the License, or (at your option) any later version. # | ||
| 8 | # # | ||
| 9 | # This program is distributed in the hope that it will be useful, # | ||
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | ||
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | ||
| 12 | # GNU General Public License for more details. # | ||
| 13 | # # | ||
| 14 | # You should have received a copy of the GNU General Public License # | ||
| 15 | # along with this program; if not, write to the Free Software # | ||
| 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.# | ||
| 17 | # # | ||
| 18 | # Jon Howell can be contacted at: # | ||
| 19 | # 6211 Sudikoff Lab, Dartmouth College # | ||
| 20 | # Hanover, NH 03755-3510 # | ||
| 21 | # jonh@cs.dartmouth.edu # | ||
| 22 | # # | ||
| 23 | # An electronic copy of the GPL is available at: # | ||
| 24 | # http://www.gnu.org/copyleft/gpl.html # | ||
| 25 | # # | ||
| 26 | ############################################################################## | ||
| 27 | |||
| 28 | use strict; | ||
| 29 | |||
| 30 | package FAQ::OMatic::changePass; | ||
| 31 | |||
| 32 | use CGI; | ||
| 33 | use FAQ::OMatic::Item; | ||
| 34 | use FAQ::OMatic; | ||
| 35 | use FAQ::OMatic::Auth; | ||
| 36 | use FAQ::OMatic::I18N; | ||
| 37 | |||
| 38 | sub main { | ||
| 39 | my $cgi = FAQ::OMatic::dispatch::cgi(); | ||
| 40 | |||
| 41 | my $params = FAQ::OMatic::getParams($cgi); | ||
| 42 | |||
| 43 | my $rt = FAQ::OMatic::pageHeader($params); | ||
| 44 | |||
| 45 | my ($id,$aq) = FAQ::OMatic::Auth::getID(); | ||
| 46 | $id =~ s/^anonymous$//; | ||
| 47 | |||
| 48 | $rt.=gettext("Please enter your username, and select a password.")."\n"; | ||
| 49 | $rt.="<p>".gettext("I will send a secret number to the email address you enter to verify that it is valid.")."\n" | ||
| 50 | .gettext("If you prefer not to give your email address to this web form, please contact") | ||
| 51 | ." $FAQ::OMatic::Config::adminEmail. <p>" | ||
| 52 | .gettext("Please <b>do not</b> use a password you use anywhere else, as it will not be transferred or stored securely!")."\n"; | ||
| 53 | |||
| 54 | $rt.=FAQ::OMatic::makeAref('submitPass', | ||
| 55 | {'badPass'=>'', # the gedID() call above may (will) set this | ||
| 56 | '_fromChangePass'=>1}, 'POST', 'saveTransients'); | ||
| 57 | |||
| 58 | if ($params->{'_admin'}) { | ||
| 59 | # don't let admin change his/her username at this point, | ||
| 60 | # since it's welded into the config file. If they do, they'll | ||
| 61 | # get confused as to why they can't continue the installation. | ||
| 62 | # (I think I had this happen once to an admin, but I didn't | ||
| 63 | # recognize the problem at the time.) | ||
| 64 | my $idDefault = $FAQ::OMatic::Config::adminAuth; | ||
| 65 | $rt.="Email: <tt>$idDefault</tt>\n" | ||
| 66 | ."<input type=hidden name=\"_id\" value=\"$idDefault\">\n"; | ||
| 67 | } else { | ||
| 68 | $rt.="Email: " | ||
| 69 | ."<input type=text name=\"_id\" size=60>\n"; | ||
| 70 | } | ||
| 71 | $rt.= "<br>".gettext("Password:")." " | ||
| 72 | ."<input type=password name=\"_pass\" value=\"\" size=10>\n"; | ||
| 73 | $rt.= "<p><input type=submit name=\"_submit\" value=\"".gettext("Set Password")."\">\n"; | ||
| 74 | $rt.= "</form>\n"; | ||
| 75 | |||
| 76 | $rt .= FAQ::OMatic::pageFooter($params); | ||
| 77 | |||
| 78 | print $rt; | ||
| 79 | } | ||
| 80 | |||
| 81 | 1; | ||
| 82 | |||
| 83 | |||
| 84 | |||
| 85 | |||
| 86 | |||
| 87 |