Esempio n. 1
0
 public function initialize()
 {
     // Search for User
     $email = $this->request->getQuery("email", "email", null);
     $token = (int) $this->request->getQuery("token", "int", null);
     $this->user = User::findLoggedIn($email, $token);
 }
Esempio n. 2
0
 public static function findAndLogin($email, $password, &$token)
 {
     if (!$email || !$password) {
         return false;
     }
     $user = User::findFirst(['conditions' => ['email' => $email]]);
     if (!$user) {
         return false;
     }
     $token = $user->login($password);
     if (!$token) {
         return false;
     }
     return $user;
 }
Esempio n. 3
0
 public function listAction()
 {
     if (!$this->user) {
         return $this->json(['success' => false]);
     }
     $calls = Call::find(['conditions' => ['providers' => $this->user->_id]]);
     $infos = [];
     foreach ($calls as $call) {
         $info['user'] = User::findById((string) $call->user);
         $info['user'] = $info['user']->toArray();
         unset($info['user']['tokens']);
         unset($info['user']['password']);
         unset($info['user']['services']);
         unset($info['user']['passwordHash']);
         $info['call'] = $call->toArray();
         $infos[] = $info;
     }
     return $this->json($infos);
 }
Esempio n. 4
0
 public function listAllAction()
 {
     return $this->json(User::find());
     // User::listAllUsers();
 }