X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FClientAPI%2FMyAccount.pm;h=81da5bcb15f2e460a0983e1f55513670a789af4f;hb=05430ec3d4d7d2303c0d8012d195923ec86fc289;hp=421a0821089d77572c3ee0a8c226ae0ff8367393;hpb=45c50af0cb0755993fa204d66cb55b3c3050487d;p=freeside.git diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 421a08210..81da5bcb1 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -24,6 +24,7 @@ FS::ClientAPI->register_handlers( 'MyAccount/list_pkgs' => \&list_pkgs, 'MyAccount/order_pkg' => \&order_pkg, 'MyAccount/cancel_pkg' => \&cancel_pkg, + 'MyAccount/charge' => \&charge, ); use vars qw( @cust_main_editable_fields ); @@ -35,26 +36,23 @@ use vars qw( @cust_main_editable_fields ); ); #store in db? -my $cache = new Cache::SharedMemoryCache(); +my $cache = new Cache::SharedMemoryCache( { + 'namespace' => 'FS::ClientAPI::MyAccount', +} ); -#false laziness w/FS::ClientAPI::passwd::passwd (needs to handle encrypted pw) +#false laziness w/FS::ClientAPI::passwd::passwd sub login { my $p = shift; my $svc_domain = qsearchs('svc_domain', { 'domain' => $p->{'domain'} } ) - or return { error => "Domain not found" }; + or return { error => 'Domain '. $p->{'domain'}. ' not found' }; - my $svc_acct = - ( length($p->{'password'}) < 13 - && qsearchs( 'svc_acct', { 'username' => $p->{'username'}, - 'domsvc' => $svc_domain->svcnum, - '_password' => $p->{'password'} } ) - ) - || qsearchs( 'svc_acct', { 'username' => $p->{'username'}, - 'domsvc' => $svc_domain->svcnum, - '_password' => $p->{'password'} } ); - - unless ( $svc_acct ) { return { error => 'Incorrect password.' } } + my $svc_acct = qsearchs( 'svc_acct', { 'username' => $p->{'username'}, + 'domsvc' => $svc_domain->svcnum, } + ); + return { error => 'User not found.' } unless $svc_acct; + return { error => 'Incorrect password.' } + unless $svc_acct->check_password($p->{'password'}); my $session = { 'svcnum' => $svc_acct->svcnum, @@ -277,7 +275,7 @@ sub order_pkg { $cust_pkg->reexport; } - return { error => '' }; + return { error => '', pkgnum => $cust_pkg->pkgnum }; }