source: sandbox/webservice/api/rest/core/LoginResource.php @ 6061

Revision 6061, 568 bytes checked in by niltonneto, 12 years ago (diff)

Ticket #2507 - Modificada implementação para tratamento de erros por Exception.

Line 
1<?php
2
3class LoginResource extends Expresso { 
4        public function post($request){
5                // to Receive POST Params (use $this->params)
6                parent::post($request);
7                if($sessionid = $GLOBALS['phpgw']->session->create($this->getParam('user'), $this->getParam('password')))
8                {
9                        $result = array(
10                                'auth'                  => $sessionid.":".$GLOBALS['phpgw']->session->kp3,
11                                'profile'               => array($this->getUserProfile())
12                        );
13                        $this->setResult($result);
14                }
15                else
16                {
17                        throw new ResponseException("",$GLOBALS['phpgw']->session->cd_reason);
18                }
19                return $this->getResponse();
20        }       
21
22}
Note: See TracBrowser for help on using the repository browser.