summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/ClientAPI/MyAccount.pm30
-rw-r--r--FS/FS/ClientAPI_XMLRPC.pm1
-rw-r--r--min_selfservice/index.php2
-rw-r--r--min_selfservice/login.php8
4 files changed, 33 insertions, 8 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index a30dde5..fe77243 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -184,6 +184,29 @@ sub skin_info {
}
+sub get_mac_address {
+ my $p = shift;
+
+## access radius exports acct tables to get mac
+ my @part_export = ();
+ @part_export = (
+ qsearch( 'part_export', { 'exporttype' => 'sqlradius' } ),
+ qsearch( 'part_export', { 'exporttype' => 'sqlradius_withdomain' } ),
+ qsearch( 'part_export', { 'exporttype' => 'broadband_sqlradius' } ),
+ );
+
+ my @sessions;
+ foreach my $part_export (@part_export) {
+ push @sessions, ( @{ $part_export->usage_sessions( {
+ 'ip' => $p->{'ip'},
+ } ) } );
+ }
+
+ my $mac = $sessions[0]->{'callingstationid'};
+
+ return { 'mac_address' => $mac, };
+}
+
sub login_info {
my $p = shift;
@@ -239,8 +262,11 @@ sub login {
} elsif ( $p->{'domain'} eq 'ip_mac' ) {
- my $svc_broadband = qsearchs( 'svc_broadband', { 'mac_addr' => $p->{'username'} } );
- return { error => 'IP address not found' }
+ my $mac_address = $p->{'username'};
+ $mac_address =~ s/\://g;
+
+ my $svc_broadband = qsearchs( 'svc_broadband', { 'mac_addr' => $mac_address } );
+ return { error => 'MAC address not found '.$p->{'username'} }
unless $svc_broadband;
$svc_x = $svc_broadband;
diff --git a/FS/FS/ClientAPI_XMLRPC.pm b/FS/FS/ClientAPI_XMLRPC.pm
index dcf34fd..db0537c 100644
--- a/FS/FS/ClientAPI_XMLRPC.pm
+++ b/FS/FS/ClientAPI_XMLRPC.pm
@@ -227,6 +227,7 @@ sub ss2clientapi {
'quotation_add_pkg' => 'MyAccount/quotation/quotation_add_pkg',
'quotation_remove_pkg' => 'MyAccount/quotation/quotation_remove_pkg',
'quotation_order' => 'MyAccount/quotation/quotation_order',
+ 'get_mac_address' => 'MyAccount/get_mac_address',
'freesideinc_service' => 'Freeside/freesideinc_service',
};
diff --git a/min_selfservice/index.php b/min_selfservice/index.php
index c7e20c5..25ec334 100644
--- a/min_selfservice/index.php
+++ b/min_selfservice/index.php
@@ -10,7 +10,7 @@
<TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0>
<TR>
<TD>
- Sorry we were unable to locate your account with ip <? echo $username; ?> .
+ Sorry we were unable to locate your account with MAC address <? echo $username; ?> .
</TD>
</TR>
</TABLE>
diff --git a/min_selfservice/login.php b/min_selfservice/login.php
index 91e19cd..b4e2b26 100644
--- a/min_selfservice/login.php
+++ b/min_selfservice/login.php
@@ -4,16 +4,14 @@ require('freeside.class.php');
$freeside = new FreesideSelfService();
$ip = $_SERVER['REMOTE_ADDR'];
-# need a routine here to get mac address from radius account table based on ip address. Every else should be good to go.
-$mac_addr = '1234567890FF';
+
+$mac_addr = $freeside->get_mac_address( array('ip' => $ip, ) );
$response = $freeside->login( array(
- 'username' => $mac_addr,
+ 'username' => $mac_addr['mac_address'],
'domain' => 'ip_mac',
) );
-#error_log("[login] received response from freeside: $response");
-
$error = $response['error'];
if ( $error ) {