-<% include('/elements/header.html', "$action $svc account") %>
+<& /elements/header.html, mt("$action [_1] account",$svc) &>
-<% include('/elements/error.html') %>
+<& /elements/error.html &>
% if ( $cust_main ) {
- <% include( '/elements/small_custview.html', $cust_main, '', 1,
- popurl(2) . "view/cust_main.cgi") %>
+ <& /elements/small_custview.html, $cust_main, '', 1,
+ popurl(2) . "view/cust_main.cgi" &>
<BR>
% }
-<SCRIPT TYPE="text/javascript">
-function randomPass() {
- var i=0;
- var pw_set='<% join('', 'a'..'z', 'A'..'Z', '0'..'9' ) %>';
- var pass='';
- while(i < 8) {
- i++;
- pass += pw_set.charAt(Math.floor(Math.random() * pw_set.length));
- }
- document.OneTrueForm.clear_password.value = pass;
-}
-</SCRIPT>
-
<FORM NAME="OneTrueForm" ACTION="<% $p1 %>process/svc_acct.cgi" METHOD=POST>
<INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $svcnum %>">
<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
<INPUT TYPE="hidden" NAME="svcpart" VALUE="<% $svcpart %>">
-Service # <% $svcnum ? "<B>$svcnum</B>" : " (NEW)" %><BR>
+% if ( $svcnum ) {
+% my $svclabel = emt("Service #[_1]",$svcnum);
+% $svclabel =~ s/$svcnum/<B>$svcnum<\/B>/;
+<% $svclabel %>
+% } else {
+<% mt("Service # (NEW)") |h %>
+% }
+<BR>
<% ntable("#cccccc",2) %>
<TR>
- <TD ALIGN="right">Service</TD>
+ <TD ALIGN="right"><% mt('Service') |h %></TD>
<TD BGCOLOR="#eeeeee"><% $part_svc->svc %></TD>
</TR>
-<TR>
- <TD ALIGN="right">Username</TD>
- <TD>
- <INPUT TYPE="text" NAME="username" VALUE="<% $username %>" SIZE=<% $ulen2 %> MAXLENGTH=<% $ulen %>>
- </TD>
+<% include('/elements/tr-td-label.html',
+ 'label' => mt('Username'),
+ 'required' => $part_svc->part_svc_column('username')->required ) %>
+% if ( $svcnum && $conf->exists('svc_acct-no_edit_username') ) {
+ <TD BGCOLOR="#eeeeee"><% $svc_acct->username() %></TD>
+ <INPUT TYPE="hidden" NAME="username" VALUE="<% $username %>">
+% } else {
+ <TD>
+ <INPUT TYPE="text" NAME="username" VALUE="<% $username %>" SIZE=<% $ulen2 %> MAXLENGTH=<% $ulen %>>
+ </TD>
+% }
</TR>
%if ( $part_svc->part_svc_column('_password')->columnflag ne 'F' ) {
-<TR>
- <TD ALIGN="right">Password</TD>
+% #XXX eventually should require "Edit Password" ACL
+<% include('/elements/tr-td-label.html',
+ 'label' => mt('Password'),
+ 'required' => $part_svc->part_svc_column('_password')->required ) %>
<TD>
- <INPUT TYPE="text" NAME="clear_password" VALUE="<% $password %>" SIZE=<% $pmax2 %> MAXLENGTH=<% $pmax %>>
- <INPUT TYPE="button" VALUE="Generate" onclick="randomPass();">
+ <INPUT TYPE="text" ID="clear_password" NAME="clear_password" VALUE="<% $password %>" SIZE=<% $pmax2 %> MAXLENGTH=<% $pmax %>>
+ <& /elements/random_pass.html, 'clear_password' &><BR>
+ <DIV ID="clear_password_result" STYLE="font-size: smaller"></DIV>
+ <& /elements/validate_password.html,
+ 'fieldid' => 'clear_password',
+ 'svcnum' => $svcnum ,
+ 'pkgnum' => $pkgnum,
+ &>
</TD>
</TR>
%}else{
<INPUT TYPE="hidden" NAME="clear_password" VALUE="<% $password %>">
%}
-<INPUT TYPE="hidden" NAME="_password_encoding" VALUE="<% $password_encoding %>">
+<INPUT TYPE="hidden" NAME="_password_encoding" VALUE="<% $svc_acct->_password_encoding %>">
%
%my $sec_phrase = $svc_acct->sec_phrase;
%if ( $conf->exists('security_phrase')
% && $part_svc->part_svc_column('sec_phrase')->columnflag ne 'F' ) {
-%
-
- <TR>
- <TD ALIGN="right">Security phrase</TD>
+<% include('/elements/tr-td-label.html',
+ 'label' => mt('Security phrase'),
+ 'required' => $part_svc->part_svc_column('sec_phrase')->required ) %>
<TD>
<INPUT TYPE="text" NAME="sec_phrase" VALUE="<% $sec_phrase %>" SIZE=32>
- (for forgotten passwords)
+ (<% mt('for forgotten passwords') |h %>)
</TD>
</TD>
% } else {
-
<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="<% $sec_phrase %>">
% }
%
%if ( $part_svc->part_svc_column('domsvc')->columnflag eq 'F' ) {
%
-
<INPUT TYPE="hidden" NAME="domsvc" VALUE="<% $domsvc %>">
% } else {
%
% if ( $domsvc ) {
% my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $domsvc, } );
% if ( $svc_domain ) {
-% $svc_domain{$svc_domain->svcnum} = $svc_domain;
+% $svc_domain{$svc_domain->svcnum} = $svc_domain->domain;
% } else {
% warn "unknown svc_domain.svcnum for svc_acct.domsvc: $domsvc";
% }
% 'pkgnum' => $pkgnum,
% )
% );
-%
-
- <TR>
- <TD ALIGN="right">Domain</TD>
+<% include('/elements/tr-td-label.html',
+ 'label' => mt('Domain'),
+ 'required' => $part_svc->part_svc_column('domsvc')->required ) %>
<TD>
<SELECT NAME="domsvc" SIZE=1>
% foreach my $svcnum (
% my $svc_domain = $svc_domain{$svcnum};
%
-
<OPTION VALUE="<% $svcnum %>" <% $svcnum == $domsvc ? ' SELECTED' : '' %>><% $svc_domain{$svcnum} %>
% }
</TD>
</TR>
% }
-%
+
+
+% if ( $communigate ) {
+
+ <TR>
+ <TD ALIGN="right"><% mt('Aliases') |h %></TD>
+ <TD><INPUT TYPE="text" NAME="cgp_aliases" VALUE="<% $svc_acct->cgp_aliases %>"></TD>
+ </TR>
+
+% } else {
+ <INPUT TYPE="hidden" NAME="cgp_aliases" VALUE="<% $svc_acct->cgp_aliases %>">
+% }
+
+
+<& /elements/tr-select-svc_pbx.html,
+ 'curr_value' => $svc_acct->pbxsvc,
+ 'part_svc' => $part_svc,
+ 'cust_pkg' => $cust_pkg,
+&>
+
%#pop
%my $popnum = $svc_acct->popnum || 0;
%if ( $part_svc->part_svc_column('popnum')->columnflag eq 'F' ) {
%
-
<INPUT TYPE="hidden" NAME="popnum" VALUE="<% $popnum %>">
% } else {
-
- <TR>
- <TD ALIGN="right">Access number</TD>
+<% include('/elements/tr-td-label.html',
+ 'label' => mt('Access number'),
+ 'required' => $part_svc->part_svc_column('popnum')->required ) %>
<TD><% FS::svc_acct_pop::popselector($popnum) %></TD>
</TR>
% }
+
+%#tower (huh)
+%if ( $conf->exists('svc_acct-tower_sector')
+% && $part_svc->part_svc_column('sectornum')->columnflag ne 'F' ) {
+ <& /elements/tr-select-tower_sector.html,
+ 'curr_value' => $svc_acct->sectornum,
+ #'part_svc' => $part_svc,
+ #'cust_pkg' => $cust_pkg,
+ 'required' => $part_svc->part_svc_column('sectornum')->required,
+ &>
+%} else {
+ <INPUT TYPE="hidden" NAME="sectornum" VALUE="<% $svc_acct->sectornum %>">
+%}
+
+<& /elements/tr-svc_export_machine.html,
+ 'svc' => $svc_acct,
+ 'part_svc' => $part_svc,
+ 'cgi' => $cgi,
+&>
+
% #uid/gid
% foreach my $xid (qw( uid gid )) {
%
%
% if ( length($svc_acct->$xid()) ) {
-
+<% include('/elements/tr-td-label.html',
+ 'label' => uc($xid),
+ 'required' => $part_svc->part_svc_column($xid)->required ) %>
<TR>
<TD ALIGN="right"><% uc($xid) %></TD>
<TD BGCOLOR="#eeeeee"><% $svc_acct->$xid() %></TD>
</TD>
</TR>
% }
-
<INPUT TYPE="hidden" NAME="<% $xid %>" VALUE="<% $svc_acct->$xid() %>">
% } else {
-
- <TR>
- <TD ALIGN="right"><% uc($xid) %></TD>
+<% include('/elements/tr-td-label.html',
+ 'label' => uc($xid),
+ 'required' => $part_svc->part_svc_column($xid)->required ) %>
<TD>
<INPUT TYPE="text" NAME="<% $xid %>" SIZE=8 MAXLENGTH=6 VALUE="<% $svc_acct->$xid() %>">
</TD>
% && ! $svc_acct->finger ) {
%
-
<INPUT TYPE="hidden" NAME="finger" VALUE="">
% } else {
- <TR>
- <TD ALIGN="right">Real Name</TD>
+<% include('/elements/tr-td-label.html',
+ 'label' => mt('Real Name'),
+ 'required' => $part_svc->part_svc_column('finger')->required ) %>
<TD>
<INPUT TYPE="text" NAME="finger" VALUE="<% $svc_acct->finger %>">
</TD>
% } else {
- <TR>
- <TD ALIGN="right">Home directory</TD>
+<% include('/elements/tr-td-label.html',
+ 'label' => mt('Home directory'),
+ 'required' => $part_svc->part_svc_column('dir')->required ) %>
<TD><INPUT TYPE="text" NAME="dir" VALUE="<% $svc_acct->dir %>"></TD>
</TR>
% }
% ) {
%
-
<INPUT TYPE="hidden" NAME="shell" VALUE="<% $shell %>">
% } else {
- <TR>
- <TD ALIGN="right">Shell</TD>
+<% include('/elements/tr-td-label.html',
+ 'label' => mt('Shell'),
+ 'required' => $part_svc->part_svc_column('shell')->required ) %>
<TD>
<SELECT NAME="shell" SIZE=1>
%
% foreach $etc_shell (@shells) {
%
-
<OPTION<% $etc_shell eq $shell ? ' SELECTED' : '' %>><% $etc_shell %>
% }
</TD>
</TR>
% }
-% if ( $part_svc->part_svc_column('quota')->columnflag eq 'F' ) {
-
-
- <INPUT TYPE="hidden" NAME="quota" VALUE="<% $svc_acct->quota %>">
-% } else {
-
-
- <TR>
- <TD ALIGN="right">Quota:</TD>
- <TD><INPUT TYPE="text" NAME="quota" VALUE="<% $svc_acct->quota %>"></TD>
- </TR>
-% }
-% if ( $part_svc->part_svc_column('slipip')->columnflag =~ /^[FA]$/ ) {
-
-
- <INPUT TYPE="hidden" NAME="slipip" VALUE="<% $svc_acct->slipip %>">
-% } else {
+<& svc_acct/communigate.html,
+ 'svc_acct' => $svc_acct,
+ 'part_svc' => $part_svc,
+ 'communigate' => $communigate,
+&>
+
+% if ( $conf->exists('svc_acct-ip_addr') ) {
+% # router/block selection UI
+% # (should we show this if slipip is fixed?)
+<& /elements/tr-select-router_block_ip.html,
+ 'object' => $svc_acct,
+ 'ip_field' => 'slipip',
+ 'required' => $part_svc->part_svc_column('routernum')->required,
+ 'ip_addr_required' => $part_svc->part_svc_column('slipip')->required,
+&>
+% } else {
+% # don't expose these to the user--they're only useful in the other case
+ <INPUT TYPE="hidden" NAME="routernum" VALUE="<% $svc_acct->routernum %>">
+ <INPUT TYPE="hidden" NAME="blocknum" VALUE="<% $svc_acct->blocknum %>">
+% if ( $part_svc->part_svc_column('slipip')->columnflag =~ /^[FA]$/ ) {
+ <INPUT TYPE="hidden" NAME="slipip" VALUE="<% $svc_acct->slipip %>">
+% } else {
+<% include('/elements/tr-td-label.html',
+ 'label' => mt('IP'),
+ 'required' => $part_svc->part_svc_column('slipip')->required ) %>
+ <TD><INPUT TYPE="text" NAME="slipip" VALUE="<% $svc_acct->slipip %>"></TD>
+ </TR>
+% }
+% }
- <TR>
- <TD ALIGN="right">IP</TD>
- <TD><INPUT TYPE="text" NAME="slipip" VALUE="<% $svc_acct->slipip %>"></TD>
- </TR>
-% }
-%
% my %label = ( seconds => 'Time',
% upbytes => 'Upload bytes',
% downbytes => 'Download bytes',
% my $tf = $uf . "_threshold";
% if ( $curuser->access_right('Edit usage') ) {
<TR>
- <TD ALIGN="right"><% $label{$uf} %> remaining</TD>
- <TD><INPUT TYPE="text" NAME="<% $uf %>" VALUE="<% $svc_acct->$uf %>">(blank disables)</TD>
+ <TD ALIGN="right"><% mt("[_1] remaining",$label{$uf}) |h %> </TD>
+ <TD><INPUT TYPE="text" NAME="<% $uf %>" VALUE="<% $svc_acct->$uf %>">(<% mt('blank disables') |h %>)</TD>
</TR>
<TR>
- <TD ALIGN="right"><% $label{$uf} %> threshold</TD>
- <TD><INPUT TYPE="text" NAME="<% $tf %>" VALUE="<% $svc_acct->$tf %>">(blank disables)</TD>
+ <TD ALIGN="right"><% mt("[_1] threshold",$label{$uf}) |h %> </TD>
+ <TD><INPUT TYPE="text" NAME="<% $tf %>" VALUE="<% $svc_acct->$tf %>">(<% mt('blank disables') |h %>)</TD>
</TR>
% }else{
<INPUT TYPE="hidden" NAME="<% $uf %>" VALUE="<% $svc_acct->$uf %>">
%
% if ( $part_svc->part_svc_column($r)->columnflag =~ /^[FA]$/ ) {
-
<INPUT TYPE="hidden" NAME="<% $r %>" VALUE="<% $svc_acct->getfield($r) %>">
% } else {
-
<TR>
<TD ALIGN="right"><% $FS::raddb::attrib{$a} %></TD>
<TD><INPUT TYPE="text" NAME="<% $r %>" VALUE="<% $svc_acct->getfield($r) %>"></TD>
% }
-
-<TR>
- <TD ALIGN="right">RADIUS groups</TD>
-% if ( $part_svc->part_svc_column('usergroup')->columnflag eq 'F' ) {
-
-
- <TD BGCOLOR="#eeeeee"><% join('<BR>', @groups) %></TD>
+<% include('/elements/tr-td-label.html',
+ 'label' => mt('RADIUS groups'),
+ 'required' => $part_svc->part_svc_column('usergroup')->required ) %>
+% if ( $part_svc_usergroup->columnflag eq 'F' ) {
+ <TD BGCOLOR="#eeeeee"><% join('<BR>', @groupnames) %></TD>
% } else {
-
-
- <TD><% FS::svc_acct::radius_usergroup_selector( \@groups ) %></TD>
+% my $radius_group_selected = '';
+% if ( $svc_acct->svcnum ) {
+% $radius_group_selected = join(',',$svc_acct->radius_groups('groupnum'));
+% }
+% elsif ( !$svc_acct->svcnum && $part_svc_usergroup->columnflag eq 'D' ) {
+% $radius_group_selected = $part_svc_usergroup->columnvalue;
+% }
+ <TD><& /elements/select-radius_group.html,
+ curr_value => $radius_group_selected,
+ element_name => 'radius_usergroup',
+ multiple => 1,
+ &>
+ </TD>
% }
-
</TR>
+
+% if ( $part_svc->has_router ) {
+<& /elements/hidden.html,
+ field => 'router_routernum',
+ curr_value => $svc_acct->router_routernum
+&>
+<& /elements/tr-input-text.html,
+ label => 'Attached router name',
+ field => 'router_routername',
+ size => 32,
+ curr_value => $svc_acct->router_routername
+&>
+<& /elements/tr-select-table.html,
+ label => 'Attached address block',
+ field => 'router_blocknum',
+ table => 'addr_block',
+ hashref => { 'routernum' => '0' },
+ extra_sql => ($svc_acct->router_routernum ?
+ ' OR routernum = '.$svc_acct->router_routernum : ''),
+ agent_virt => 1,
+ agent_null => 1,
+ name_col => 'cidr',
+ order_by => 'ORDER BY ip_gateway, ip_netmask',
+ empty_label => '(none)',
+ disable_empty => 0,
+ curr_value => $svc_acct->router_blocknum
+&>
+% }
+
% foreach my $field ($svc_acct->virtual_fields) {
% # If the flag is X, it won't even show up in $svc_acct->virtual_fields.
% if ( $part_svc->part_svc_column($field)->columnflag ne 'F' ) {
-
<% $svc_acct->pvf($field)->widget('HTML', 'edit', $svc_acct->getfield($field)) %>
% }
% }
-
</TABLE>
<BR>
+% if ( $captcha_url ) {
+<IMG SRC="<% $captcha_url %>"><BR>
+<% mt('Enter the word shown above:') |h %> <INPUT TYPE="text" NAME="captcha_response"><BR>
+<BR>
+% }
+
<INPUT TYPE="submit" VALUE="Submit">
</FORM>
-<% include('/elements/footer.html') %>
+<& /elements/footer.html &>
<%init>
$part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart});
die "No part_svc entry!" unless $part_svc;
- $svc_acct = new FS::svc_acct({svcpart => $svcpart});
+ $svc_acct = new FS::svc_acct({svcpart => $svcpart});
+
+ $svcnum='';
- $svcnum='';
+ $svc_acct->password_recover('Y'); #default. hmm.
} else { #editing
}
+my $communigate = scalar($part_svc->part_export('communigate_pro'));
+ # || scalar($part_svc->part_export('communigate_pro_singledomain'));
+
my( $cust_pkg, $cust_main ) = ( '', '' );
if ( $pkgnum ) {
$cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $pkgnum } );
}
+my $part_svc_usergroup = $part_svc->part_svc_column('usergroup');
#fixed radius groups always override & display
-if ( $part_svc->part_svc_column('usergroup')->columnflag eq 'F' ) {
- @groups = split(',', $part_svc->part_svc_column('usergroup')->columnvalue);
+my @groupnames; # only used for display of Fixed RADIUS groups
+if ( $part_svc_usergroup->columnflag eq 'F' ) {
+ @groups = split(',',$part_svc_usergroup->columnvalue);
+ @groupnames = map { $_->long_description }
+ qsearch({ 'table' => 'radius_group',
+ 'extra_sql' => "where groupnum in (".$part_svc_usergroup->columnvalue.")",
+ }) if length($part_svc_usergroup->columnvalue);
}
my $action = $svcnum ? 'Edit' : 'Add';
my $otaker = getotaker;
my $username = $svc_acct->username;
-my $password;
-my $password_encryption = $svc_acct->_password_encryption;
-my $password_encoding = $svc_acct->_password_encoding;
-
-if($svcnum) {
- if($password = $svc_acct->get_cleartext_password) {
- if (! $conf->exists('showpasswords')) {
- $password = '*HIDDEN*';
- }
- }
- elsif($svc_acct->_password and $password_encryption ne 'plain') {
+
+my $password = '';
+if ( $cgi->param('error') ) {
+ $password = $cgi->param('clear_password');
+} elsif ( $svcnum ) {
+ my $password_encryption = $svc_acct->_password_encryption;
+ if ( $password = $svc_acct->get_cleartext_password ) {
+ $password = '*HIDDEN*' unless $conf->exists('showpasswords');
+ } elsif( $svc_acct->_password and $password_encryption ne 'plain' ) {
$password = "(".uc($password_encryption)." encrypted)";
}
- else {
- $password = '';
- }
}
my $ulen =
(sort(@_))[-1]
}
+my $captcha_url;
+my ($export_google) = $part_svc->part_export('acct_google');
+if ( $export_google ) {
+ my $error = $export_google->auth_error;
+ if ( $error ) {
+ if ( $error->{'captcha_url'} ) {
+ $captcha_url = $error->{'captcha_url'};
+ }
+ else {
+ $cgi->param('error', $error->{'message'});
+ }
+ } #if $error
+}
+
+if ( $part_svc->has_router ) { # duplicates the one in elements/svc_Common
+ if ( $svcnum ) {
+ my $router = qsearchs('router', {svcnum => $svc_acct->svcnum});
+ if ( $router ) {
+ $svc_acct->set("router_$_", $router->get($_))
+ foreach ('routername', 'routernum');
+ my ($block) = $router->addr_block;
+ $svc_acct->set('router_blocknum', $block->blocknum) if ( $block );
+ }
+ }
+ foreach (qw(router_routername router_routernum router_blocknum)) {
+ if ( $cgi->param($_) =~ /^(\w+)$/ ) {
+ $svc_acct->set($_, $1);
+ }
+ }
+}
+
</%init>