diff options
author | Christopher Burger <burgerc@freeside.biz> | 2017-06-20 09:04:14 -0400 |
---|---|---|
committer | Christopher Burger <burgerc@freeside.biz> | 2017-06-20 09:04:14 -0400 |
commit | 2eefefbe2f93bd6f306c7f73443028dbfd70782e (patch) | |
tree | 01888b94bac72a8d7ec8c85ea439a6d0a1749e59 /httemplate/elements | |
parent | 0cf46c59eb42596a1823f70e8facf2f457c0e43b (diff) |
RT# 75817 - Added the ability to set contacts password on the backend
Diffstat (limited to 'httemplate/elements')
-rw-r--r-- | httemplate/elements/change_password.html | 36 | ||||
-rw-r--r-- | httemplate/elements/contact.html | 16 | ||||
-rw-r--r-- | httemplate/elements/validate_password.html | 2 |
3 files changed, 45 insertions, 9 deletions
diff --git a/httemplate/elements/change_password.html b/httemplate/elements/change_password.html index a84e823d2..b3a432f95 100644 --- a/httemplate/elements/change_password.html +++ b/httemplate/elements/change_password.html @@ -8,19 +8,19 @@ display: none; } </STYLE> -<A ID="<%$pre%>link" HREF="javascript:void(0)" onclick="<%$pre%>toggle(true)">(<% emt('change') %>)</A> +<A ID="<%$pre%>link" HREF="javascript:void(0)" onclick="<%$pre%>toggle(true)">(<% emt( $change_title ) %>)</A> <DIV ID="<%$pre%>form" CLASS="passwordbox"> <FORM METHOD="POST" ACTION="<%$fsurl%>misc/process/change-password.html"> - <INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $svc_acct->svcnum |h%>"> + <% $change_id_input %> <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)"> <DIV ID="<%$pre%>password_result" STYLE="font-size: smaller"></DIV> <& '/elements/validate_password.html', - 'fieldid' => $pre.'password', - 'svcnum' => $svc_acct->svcnum, - + 'fieldid' => $pre.'password', + 'svcnum' => $svcnum, + 'contactnum' => $contactnum, &> % if ( $error ) { <BR><SPAN STYLE="color: #ff0000"><% $error |h %></SPAN> @@ -40,8 +40,28 @@ function <%$pre%>toggle(val) { </SCRIPT> <%init> my %opt = @_; -my $svc_acct = $opt{'svc_acct'}; + +my $contactnum = $opt{'contact_num'}; my $curr_value = $opt{'curr_value'} || ''; -my $pre = 'changepw'.$svc_acct->svcnum.'_'; -my $error = $cgi->param($pre.'error'); +my $change_title = $opt{'label'} || 'change'; + +my $svcnum; +my $change_id_input = ''; +my $pre = 'changepw'; + +if ($opt{'svc_acct'}) { + my $svc_acct = $opt{'svc_acct'}; + $change_id_input = '<INPUT TYPE="hidden" NAME="svcnum" VALUE="' . $svc_acct->svcnum . '">'; + $pre .= $svc_acct->svcnum . '_'; + $svcnum = $svc_acct->svcnum; +} +elsif ($opt{'contact_num'}) { + $change_id_input = ' + <INPUT TYPE="hidden" NAME="contactnum" VALUE="' . $opt{'contact_num'} . '"> + <INPUT TYPE="hidden" NAME="custnum" VALUE="' . $opt{'custnum'} . '"> + '; + $pre .= $opt{'contact_num'} . '_'; +} + + my $error = $cgi->param($pre.'error'); </%init> diff --git a/httemplate/elements/contact.html b/httemplate/elements/contact.html index b0a7caca1..8936569ce 100644 --- a/httemplate/elements/contact.html +++ b/httemplate/elements/contact.html @@ -85,6 +85,22 @@ <FONT SIZE="-1"><% $label{$field} %></FONT> </TD> % } +% my $pwd_change_label = 'change password'; +% $pwd_change_label = 'setup password' unless $contact->_password; +% 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> + <br> + <FONT SIZE="-1">Password</FONT> + </TD> +% } </TR> </TABLE> diff --git a/httemplate/elements/validate_password.html b/httemplate/elements/validate_password.html index a488c4f16..bd385a6ca 100644 --- a/httemplate/elements/validate_password.html +++ b/httemplate/elements/validate_password.html @@ -27,7 +27,7 @@ function add_password_validation (fieldid) { var resultfield = document.getElementById(fieldid); if (this.value) { resultfield.innerHTML = '<SPAN STYLE="color: blue;">Validating password...</SPAN>'; - validate_password('fieldid',fieldid,'svcnum','<% $opt{'svcnum'} %>','password',this.value, + validate_password('fieldid',fieldid,'svcnum','<% $opt{'svcnum'} %>','contactnum','<% $opt{'contactnum'} %>','password',this.value, function (result) { result = JSON.parse(result); var resultfield = document.getElementById(result.fieldid); |