X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fprocess%2Fchange-password.html;h=1c746a4e0a36098abcc8e43a421d9c828e52b664;hb=b71b1576c68bc40ad26592b354feace37a029f0e;hp=be83786cdb82cf502c1aa254bd3ec4286219a862;hpb=e773f2d834f6757e7a0430184d9db6939e0b632d;p=freeside.git diff --git a/httemplate/misc/process/change-password.html b/httemplate/misc/process/change-password.html index be83786cd..1c746a4e0 100644 --- a/httemplate/misc/process/change-password.html +++ b/httemplate/misc/process/change-password.html @@ -7,6 +7,7 @@ % $cgi->param('contactnum', $contactnum); % $cgi->param("changepw${contactnum}_error", $error); % } +% $cgi->param('error', $error); % } else { % if ($svcnum) { $cgi->query_string($svcnum); } % elsif ($contactnum) { $cgi->query_string($contactnum); } @@ -17,7 +18,15 @@ <% $cgi->redirect($fsurl.'view/svc_acct.cgi?'.$cgi->query_string) %> % } % elsif ($contactnum) { - <% $cgi->redirect($fsurl.'edit/cust_main-contacts.html?'.$cgi->param('custnum')) %> +% my $freeside_status = "Contact ".$contact->{'Hash'}->{'first'}." ".$contact->{'Hash'}->{'last'}." password updated."; + <% $cgi->redirect( -uri => popurl(3). "view/cust_main.cgi?". $cgi->param('custnum'), + -cookie => CGI::Cookie->new( + -name => 'freeside_status', + -value => mt($freeside_status), + -expires => '+5m', + ), + ) +%> % } % } @@ -29,10 +38,15 @@ <%init> my $curuser = $FS::CurrentUser::CurrentUser; +my $contact; $cgi->param('svcnum') =~ /^(\d+)$/ or die "illegal svcnum" if $cgi->param('svcnum'); my $svcnum = $1; +foreach my $prefix (grep /^(.*)(password)$/, $cgi->param) { + $cgi->param('password' => $cgi->param($prefix)); +} + $cgi->param('contactnum') =~ /^(\d+)$/ or die "illegal contactnum" if $cgi->param('contactnum'); my $contactnum = $1; @@ -52,7 +66,7 @@ if ($svcnum) { ! $part_svc->restrict_edit_password ) ); - my $error = $svc_acct->is_password_allowed($newpass) + $error = $svc_acct->is_password_allowed($newpass) || $svc_acct->set_password($newpass) || $svc_acct->replace; @@ -60,10 +74,10 @@ if ($svcnum) { $cgi->delete('password'); } elsif ($contactnum) { - my $contact = qsearchs('contact', { 'contactnum' => $contactnum } ) + $contact = qsearchs('contact', { 'contactnum' => $contactnum } ) or return { 'error' => "Contact not found" . $contactnum }; - my $error = $contact->is_password_allowed($newpass) + $error = $contact->is_password_allowed($newpass) || $contact->change_password($newpass); # annoyingly specific to view/svc_acct.cgi, for now...