From: Christopher Burger Date: Tue, 4 Sep 2018 12:30:35 +0000 (-0400) Subject: RT# 75817 - Added password change link to cust main page X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=405f925e2578705780332900eb5df031bfa7c272 RT# 75817 - Added password change link to cust main page Conflicts: httemplate/edit/cust_main-contacts.html httemplate/elements/validate_password.html httemplate/view/cust_main/contacts_new.html --- diff --git a/httemplate/edit/cust_main-contacts.html b/httemplate/edit/cust_main-contacts.html index aeedd78e5..b3f67726b 100644 --- a/httemplate/edit/cust_main-contacts.html +++ b/httemplate/edit/cust_main-contacts.html @@ -1,15 +1,17 @@ +<& '/elements/validate_password_js.html', &> + <& elements/edit.html, 'name_singular' => 'customer contacts', #yes, we're editing all of them 'table' => 'cust_main', diff --git a/httemplate/elements/change_password.html b/httemplate/elements/change_password.html index 7d95e19dc..65b7d8502 100644 --- a/httemplate/elements/change_password.html +++ b/httemplate/elements/change_password.html @@ -11,9 +11,9 @@ % if (!$opt{'no_label_display'}) { (<% emt( $change_title ) %>) % } -
+
% if (!$opt{'noformtag'}) { -
+ % } <% $change_id_input %> @@ -44,11 +44,8 @@ function <%$pre%>toggle(toggle, clear) { if (clear) { document.getElementById('<%$pre%>password').value = ''; document.getElementById('<%$pre%>password_result').innerHTML = ''; -% if ($opt{'contact_num'}) { - document.getElementById('<% $opt{'pre_pwd_field_label'} %>selfservice_access').value = 'Y'; -% } } - document.getElementById('<%$pre%>form').style.display = + document.getElementById('<%$pre%>div').style.display = toggle ? 'inline-block' : 'none'; % if (!$opt{'no_label_display'}) { document.getElementById('<%$pre%>link').style.display = @@ -56,7 +53,7 @@ function <%$pre%>toggle(toggle, clear) { % } } -function checkPasswordValidation() { +function <%$pre%>checkPasswordValidation(resultId) { var validationResult = document.getElementById('<%$pre%>password_result').innerHTML; if (validationResult.match(/Password valid!/)) { return true; @@ -83,8 +80,8 @@ if ($opt{'svc_acct'}) { } elsif ($opt{'contact_num'}) { $change_id_input = ' - - + + '; $pre .= $opt{'pre_pwd_field_label'}; } diff --git a/httemplate/elements/contact.html b/httemplate/elements/contact.html index a915a5876..e330e1fea 100644 --- a/httemplate/elements/contact.html +++ b/httemplate/elements/contact.html @@ -71,12 +71,10 @@ placeholder = "<% $value |h %>" > % my $contactnum = $curr_value ? $curr_value : '0'; - <& '/elements/validate_password.html', - 'fieldid' => "changepw".$id."_password", - 'svcnum' => '', - 'contactnum' => $contactnum, - 'submitid' => "submit", - &> + + <%init> diff --git a/httemplate/misc/process/change-password.html b/httemplate/misc/process/change-password.html index a3e060168..37ad6d915 100644 --- a/httemplate/misc/process/change-password.html +++ b/httemplate/misc/process/change-password.html @@ -18,7 +18,7 @@ <% $cgi->redirect($fsurl.'view/svc_acct.cgi?'.$cgi->query_string) %> % } % elsif ($contactnum) { - <% $cgi->redirect($fsurl.'edit/cust_main-contacts.html?'.$cgi->param('custnum')) %> + <% $cgi->redirect($fsurl.'view/cust_main.cgi?'.$cgi->param('custnum')) %> % } % } @@ -34,6 +34,10 @@ my $curuser = $FS::CurrentUser::CurrentUser; $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; diff --git a/httemplate/view/cust_main/contacts_new.html b/httemplate/view/cust_main/contacts_new.html index f73483ae1..19118ea27 100644 --- a/httemplate/view/cust_main/contacts_new.html +++ b/httemplate/view/cust_main/contacts_new.html @@ -6,6 +6,7 @@ % my $bgcolor1 = '#eeeeee'; % my $bgcolor2 = '#ffffff'; % my $bgcolor = $bgcolor2; +% my $count = 0; Type Contact @@ -29,6 +30,16 @@ Enabled %# disable %# re-email + + <& /elements/change_password.html, + 'contact_num' => $contact->contactnum, + 'custnum' => $contact->custnum, + 'no_label_display' => '', + 'label' => 'change password', + 'curr_value' => '', + 'pre_pwd_field_label' => 'contact'.$count.'_', + &> + % } else { Disabled %# enable @@ -51,6 +62,7 @@ % } else { % $bgcolor = $bgcolor1; % } +% $count++; % } <%once> @@ -64,5 +76,6 @@ my( $cust_main ) = @_; #my $conf = new FS::Conf; my @contacts = $cust_main->cust_contact; +my $display = scalar(@contacts) > 0;