Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function signin($username='', $password='') {
- if (isset($username) && isset($password)) {
- $customer = $this->Customer->find('first', array('conditions' => array('Customer.customers_username' => $username)));
- if (!empty($customer['Customer']['customers_id']) && $customer['Customer']['customers_password'] == md5($password)) {
- $data = array('Customer' => array('username' => $username, 'password' => $password));
- $this->Auth->login($data);
- $sessionInfo = $this->Session->read();
- $output = array(
- 'loginResponse' => array(
- 'sessionID' => $sessionInfo['Config']['userAgent']
- )
- );
- } else {
- $output = array(
- 'error' => array(
- 'errorCode' => 'INVALID_LOGIN',
- 'description' => 'Invalid username or password'
- )
- );
- }
- $this->set('output',$output);
- }
- }
Add Comment
Please, Sign In to add comment