Revision 6019,
797 bytes
checked in by niltonneto, 12 years ago
(diff) |
Ticket #2507 - Modificada implementação para alinhamento com projeto de camada REST.
|
Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | class LoginResource extends Expresso { |
---|
4 | public function post($request){ |
---|
5 | // to Receive POST Params (use $this->params) |
---|
6 | parent::post($request); |
---|
7 | |
---|
8 | if(!$this-> isLoggedIn()) |
---|
9 | { |
---|
10 | if($sessionid = $GLOBALS['phpgw']->session->create($this->getParam('user'), $this->getParam('password'))) |
---|
11 | { |
---|
12 | $result = array( |
---|
13 | 'auth' => $sessionid.":".$GLOBALS['phpgw']->session->kp3, |
---|
14 | 'profile' => array($this->getUserProfile()) |
---|
15 | ); |
---|
16 | $this->setError(false); |
---|
17 | $this->setResult($result); |
---|
18 | } |
---|
19 | else |
---|
20 | { |
---|
21 | $this->setError($GLOBALS['phpgw']->session->cd_reason); |
---|
22 | } |
---|
23 | } |
---|
24 | else |
---|
25 | { |
---|
26 | $result = array('auth' => $this->getParam('auth')); |
---|
27 | $this->setResult($result); |
---|
28 | } |
---|
29 | |
---|
30 | //to Send Response (JSON RPC format) |
---|
31 | return $this->getResponse(); |
---|
32 | } |
---|
33 | |
---|
34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.