[Added screen for sip login reminder Adrian Georgescu **20090118110111] hunk ./library/ngnpro_client.php 2911 + + function showPasswordReminderForm() { + printf (" +
+

Password reminder

+

Fill in the e-mail address used during the registration of the SIP account: +

+ + +

+ ", + $this->filters['email']); + } + + function getAccountsForPasswordReminder($maximum_accounts=3) { + + $accounts=array(); + + $filter = array('email' => $this->filters['email']); + + $range = array('start' => 0, + 'count' => $maximum_accounts); + + $orderBy = array('attribute' => 'changeDate', + 'direction' => 'DESC'); + + $Query = array('filter' => $filter, + 'orderBy' => $orderBy, + 'range' => $range); + + $this->SoapEngine->soapclient->addHeader($this->SoapEngine->SoapAuth); + $result = $this->SoapEngine->soapclient->getAccounts($Query); + + if (PEAR::isError($result)) { + $error_msg = $result->getMessage(); + $error_fault= $result->getFault(); + $error_code = $result->getCode(); + printf ("

Error from %s: %s (%s): %s",$this->SoapEngine->SOAPurl,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); + } else { + $i=0; + + while ($i < $result->total) { + if (!$result->accounts[$i]) break; + $account = $result->accounts[$i]; + $accounts[]=array('username'=> $account->id->username, + 'domain' => $account->id->domain + ); + $i++; + } + } + + return $accounts; + } hunk ./phplib/local.inc 323 - var $database_class = "DB_subscribers"; - var $database_table = "subscriber"; hunk ./phplib/local.inc 370 - $SIP['customer'] = $domainFilters[$domain]['customer']; - $SIP['reseller'] = $domainFilters[$domain]['reseller']; - hunk ./phplib/local.inc 373 - print "Error: no domainFilter available in ngnpro_engines.inc"; + print "Error: cannot authenticate SIP subscriber, no domainFilter defined in ngnpro_engines.inc"; hunk ./phplib/local.inc 387 - $log=sprintf ("Forward authorization to %s",$soapEngines[$SIP['engine']]['url']); - - dprint($log); - hunk ./phplib/local.inc 394 - //dprint_r($result); - hunk ./phplib/local.inc 405 + $SIP['customer'] = $result->customer; + $SIP['reseller'] = $result->reseller; + hunk ./phplib/local.inc 415 + hunk ./sip_login.phtml 71 + +

Password or username forgotten? Click here to receive a reminder. + addfile ./sip_login_reminder.phtml hunk ./sip_login_reminder.phtml 1 - + 'admin'); + +$SoapEngine = new SoapEngine('sip_accounts',$soapEngines,$login_credentials); +$_class = $SoapEngine->records_class; +$RECORDS = new $_class(&$SoapEngine); + +$login_credentials['sip_engine'] = $RECORDS->SoapEngine->sip_engine; + +$RECORDS->showPasswordReminderForm(); + +if ($_REQUEST['email_filter']) { + $accounts=$RECORDS->getAccountsForPasswordReminder(); + + if (count($accounts)) { + printf ("

Found %d accounts having email address set to '%s'",count($accounts),trim($_REQUEST['email_filter'])); + } + + foreach ($accounts as $_account) { + $account=$_account['username'].'@'.$_account['domain']; + $SipSettings = new SipSettings($account,$login_credentials,$soapEngines); + $SipSettings->sendEmail(); + } +} + +print "

Back to SIP settings page"; + +print " + + +"; + +?> hunk ./version 1 -6.7.1 +6.7.2