Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / httemplate / misc / process / change-password.html
index 250e832..a3e0601 100644 (file)
@@ -1,3 +1,33 @@
+% if ( $error ) {
+%      if ($svcnum) {
+%              $cgi->param('svcnum', $svcnum);
+%              $cgi->param("changepw${svcnum}_error", $error);
+%      }
+%      elsif ($contactnum) {
+%              $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); }
+% }
+
+% if (!$popup) {
+%   if ($svcnum) { 
+        <% $cgi->redirect($fsurl.'view/svc_acct.cgi?'.$cgi->query_string) %>
+%   }
+%   elsif ($contactnum) { 
+        <% $cgi->redirect($fsurl.'edit/cust_main-contacts.html?'.$cgi->param('custnum')) %>
+%   }
+% }
+
+<& /elements/header-popup.html, 'Password Set' &>
+<SCRIPT TYPE="text/javascript">
+  topreload();
+  parent.cClick();
+</SCRIPT>
+
 <%init>
 my $curuser = $FS::CurrentUser::CurrentUser;
 
@@ -7,6 +37,8 @@ my $svcnum = $1;
 $cgi->param('contactnum') =~ /^(\d+)$/ or die "illegal contactnum" if $cgi->param('contactnum');
 my $contactnum = $1;
 
+my $popup = $cgi->param('popup');
+
 my $newpass = $cgi->param('password');
 
 my $error;
@@ -21,7 +53,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;
 
@@ -32,32 +64,11 @@ elsif ($contactnum) {
        my $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...
        #$cgi->delete('password');
 }
 
-</%init>
-% if ( $error ) {
-%      if ($svcnum) {
-%              $cgi->param('svcnum', $svcnum);
-%              $cgi->param("changepw${svcnum}_error", $error);
-%      }
-%      elsif ($contactnum) {
-%              $cgi->param('contactnum', $contactnum);
-%              $cgi->param("changepw${contactnum}_error", $error);
-%      }
-% } else {
-%      if ($svcnum) { $cgi->query_string($svcnum); }
-%      elsif ($contactnum) { $cgi->query_string($contactnum); }
-% }
-%warn('my pwd error is ' . $error . ' end');
-% if ($svcnum) { 
-       <% $cgi->redirect($fsurl.'view/svc_acct.cgi?'.$cgi->query_string) %>
-% }
-% elsif ($contactnum) { 
-       <% $cgi->redirect($fsurl.'edit/cust_main-contacts.html?'.$cgi->param('custnum')) %>
-% }
-
+</%init>
\ No newline at end of file