--- /dev/null
+<% 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
<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',
document.getElementById('<%$pre%>link').style.display =
val ? 'none' : 'inline';
}
-% if ( $error ) {
+% if ( $error || $opt{'popup'} ) {
<%$pre%>toggle(true);
% }
</SCRIPT>
$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>
<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>
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';
+% 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;
$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;
#$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