[freeside-commits] freeside/FS/FS/ClientAPI MyAccount.pm, 1.67, 1.68
Ivan,,,
ivan at wavetail.420.am
Sun Mar 16 15:24:25 PDT 2008
Update of /home/cvs/cvsroot/freeside/FS/FS/ClientAPI
In directory wavetail.420.am:/tmp/cvs-serv5391/ClientAPI
Modified Files:
MyAccount.pm
Log Message:
phonenum + pin login
Index: MyAccount.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI/MyAccount.pm,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- MyAccount.pm 23 Jan 2008 19:18:39 -0000 1.67
+++ MyAccount.pm 16 Mar 2008 22:24:23 -0000 1.68
@@ -17,6 +17,7 @@
use FS::ClientAPI_SessionCache;
use FS::svc_acct;
use FS::svc_domain;
+use FS::svc_phone;
use FS::svc_external;
use FS::part_svc;
use FS::cust_main;
@@ -57,28 +58,53 @@
sub login {
my $p = shift;
- my $svc_domain = qsearchs('svc_domain', { 'domain' => $p->{'domain'} } )
- or return { error => 'Domain '. $p->{'domain'}. ' not found' };
+ my $conf = new FS::Conf;
- my $svc_acct = qsearchs( 'svc_acct', { 'username' => $p->{'username'},
- 'domsvc' => $svc_domain->svcnum, }
- );
- return { error => 'User not found.' } unless $svc_acct;
+ my $svc_x = '';
+ if ( $p->{'domain'} eq 'svc_phone'
+ && $conf->exists('selfservice_server-phone_login') ) {
- my $conf = new FS::Conf;
- my $pkg_svc = $svc_acct->cust_svc->pkg_svc;
- return { error => 'Only primary user may log in.' }
- if $conf->exists('selfservice_server-primary_only')
- && ( ! $pkg_svc || $pkg_svc->primary_svc ne 'Y' );
+ my $svc_phone = qsearch( 'svc_phone', { 'phonenum' => $p->{'username'}, } );
+ return { error => 'Number not found.' } unless $svc_phone
- return { error => 'Incorrect password.' }
- unless $svc_acct->check_password($p->{'password'});
+ #XXX?
+ #my $pkg_svc = $svc_acct->cust_svc->pkg_svc;
+ #return { error => 'Only primary user may log in.' }
+ # if $conf->exists('selfservice_server-primary_only')
+ # && ( ! $pkg_svc || $pkg_svc->primary_svc ne 'Y' );
+
+ return { error => 'Incorrect PIN.' }
+ unless $svc_phone->check_pin($p->{'password'});
+
+ $svc_x = $svc_phone;
+
+ } else {
+
+ my $svc_domain = qsearchs('svc_domain', { 'domain' => $p->{'domain'} } )
+ or return { error => 'Domain '. $p->{'domain'}. ' not found' };
+
+ my $svc_acct = qsearchs( 'svc_acct', { 'username' => $p->{'username'},
+ 'domsvc' => $svc_domain->svcnum, }
+ );
+ return { error => 'User not found.' } unless $svc_acct;
+
+ my $pkg_svc = $svc_acct->cust_svc->pkg_svc;
+ return { error => 'Only primary user may log in.' }
+ if $conf->exists('selfservice_server-primary_only')
+ && ( ! $pkg_svc || $pkg_svc->primary_svc ne 'Y' );
+
+ return { error => 'Incorrect password.' }
+ unless $svc_acct->check_password($p->{'password'});
+
+ $svc_x = $svc_acct;
+
+ }
my $session = {
- 'svcnum' => $svc_acct->svcnum,
+ 'svcnum' => $svc_x->svcnum,
};
- my $cust_pkg = $svc_acct->cust_svc->cust_pkg;
+ my $cust_pkg = $svc_x->cust_svc->cust_pkg;
if ( $cust_pkg ) {
my $cust_main = $cust_pkg->cust_main;
$session->{'custnum'} = $cust_main->custnum;
More information about the freeside-commits
mailing list