diff options
author | Christopher Burger <burgerc@freeside.biz> | 2017-06-29 12:51:25 -0400 |
---|---|---|
committer | Christopher Burger <burgerc@freeside.biz> | 2017-06-29 12:51:25 -0400 |
commit | e773f2d834f6757e7a0430184d9db6939e0b632d (patch) | |
tree | 4d7fbe001ed6dc0197e532db6e238a5522380c65 | |
parent | a616d0c27799413dfbe07ee86e75df3e0d5a740f (diff) |
RT# 75817 - updated set contact password to use popup window. fixes break in first contact.
-rw-r--r-- | httemplate/edit/cust_main-contacts-password.html | 34 | ||||
-rw-r--r-- | httemplate/elements/change_password.html | 13 | ||||
-rw-r--r-- | httemplate/elements/contact.html | 26 | ||||
-rw-r--r-- | httemplate/misc/process/change-password.html | 54 |
4 files changed, 93 insertions, 34 deletions
diff --git a/httemplate/edit/cust_main-contacts-password.html b/httemplate/edit/cust_main-contacts-password.html new file mode 100644 index 000000000..e3c1d6fa8 --- /dev/null +++ b/httemplate/edit/cust_main-contacts-password.html @@ -0,0 +1,34 @@ +<% include("/elements/header-popup.html", $title) %> +For Contact <% $contact->first %> <% $contact->last %> +<P> +<& /elements/change_password.html, + 'contact_num' => $contactnum, + 'custnum' => $custnum, + 'curr_value' => '', + 'label' => $label, + 'popup' => $popup, +&> + +<%init> + +my $curuser = $FS::CurrentUser::CurrentUser; + +$cgi->param('contactnum') =~ /^(\d+)$/ or die "illegal contactnum" if $cgi->param('contactnum'); +my $contactnum = $1; + +$cgi->param('custnum') =~ /^(\d+)$/ or die "illegal customernum" if $cgi->param('custnum'); +my $custnum = $1; + +my $label = "change password"; +$label = "set password" unless ($cgi->param('label') eq "change"); +my $title = $label; +$title =~ s/\b(\w)/\U$1/g; + +my $popup = $cgi->param('popup'); + +die "access denied" + unless $curuser->access_right(($custnum ? 'Edit' : 'New'). ' customer'); #password? + +my $contact = qsearchs('contact', { 'contactnum' => $contactnum } ); + +</%init>
\ No newline at end of file diff --git a/httemplate/elements/change_password.html b/httemplate/elements/change_password.html index b3a432f95..a8cc883b9 100644 --- a/httemplate/elements/change_password.html +++ b/httemplate/elements/change_password.html @@ -15,7 +15,12 @@ <INPUT TYPE="text" ID="<%$pre%>password" NAME="password" VALUE="<% $curr_value |h%>"> <& /elements/random_pass.html, $pre.'password', 'randomize' &> <INPUT TYPE="submit" VALUE="change"> - <INPUT TYPE="button" VALUE="cancel" onclick="<%$pre%>toggle(false)"> +% if ($opt{'popup'}) { + <INPUT TYPE="button" VALUE="cancel" onclick="parent.cClick();"> +% } +% else { + <INPUT TYPE="button" VALUE="cancel" onclick="<%$pre%>toggle(false)"> +%} <DIV ID="<%$pre%>password_result" STYLE="font-size: smaller"></DIV> <& '/elements/validate_password.html', 'fieldid' => $pre.'password', @@ -34,7 +39,7 @@ function <%$pre%>toggle(val) { document.getElementById('<%$pre%>link').style.display = val ? 'none' : 'inline'; } -% if ( $error ) { +% if ( $error || $opt{'popup'} ) { <%$pre%>toggle(true); % } </SCRIPT> @@ -63,5 +68,9 @@ elsif ($opt{'contact_num'}) { $pre .= $opt{'contact_num'} . '_'; } +if ($opt{'popup'}) { + $change_id_input .= '<INPUT TYPE="hidden" NAME="popup" VALUE="' . $opt{'popup'} . '">'; +} + my $error = $cgi->param($pre.'error'); </%init> diff --git a/httemplate/elements/contact.html b/httemplate/elements/contact.html index 8936569ce..072270ea8 100644 --- a/httemplate/elements/contact.html +++ b/httemplate/elements/contact.html @@ -85,18 +85,20 @@ <FONT SIZE="-1"><% $label{$field} %></FONT> </TD> % } -% my $pwd_change_label = 'change password'; -% $pwd_change_label = 'setup password' unless $contact->_password; +% my $pwd_change_label = 'change'; +% $pwd_change_label = 'setup' unless $contact->_password; +% my $action = $fsurl . "edit/cust_main-contacts-password.html?custnum=" . $opt{'custnum'} . "&contactnum=" . $curr_value . "&label=" . $pwd_change_label . "&popup=1"; % if ($curr_value) { <TD> - <span STYLE="white-space: nowrap"> - <& /elements/change_password.html, - 'contact_num' => $curr_value, - 'custnum' => $opt{'custnum'}, - 'curr_value' => '', - 'label' => $pwd_change_label, - &> - </span> + <% include('/elements/popup_link.html', + 'action' => $action, + 'width' => '763', + 'height' => '408', + 'actionlabel' => "$pwd_change_label password", + 'html_label' => "$pwd_change_label password", + + ) + %> <br> <FONT SIZE="-1">Password</FONT> </TD> @@ -110,6 +112,10 @@ my( %opt ) = @_; my $conf = new FS::Conf; + +use Data::Dumper; +print Dumper($conf->config); + my $self_base_url = $conf->config('selfservice_server-base_url'); my $name = $opt{'element_name'} || $opt{'field'} || 'contactnum'; diff --git a/httemplate/misc/process/change-password.html b/httemplate/misc/process/change-password.html index 250e8320b..be83786cd 100644 --- a/httemplate/misc/process/change-password.html +++ b/httemplate/misc/process/change-password.html @@ -1,3 +1,32 @@ +% 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); } +% } + +% 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 +36,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; @@ -39,25 +70,4 @@ elsif ($contactnum) { #$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 |