/** * @param User $user * @return bool */ public function handle(User $user) { $conn = $this->app['db']; $loggedUser = $conn->fetchAssoc('SELECT * FROM user WHERE username = ? AND status = ?', array($user->getUsername(), "active")); if (count($loggedUser) > 0) { $passCheck = password_verify($user->getPassword(), $loggedUser['password']); if ($passCheck) { return true; } else { return false; } } else { return false; } }
/** * @param User $user */ public function handle(User $user) { $conn = $this->app['db']; $conn->insert('user', array('username' => $user->getUsername(), 'password' => password_hash($user->getPassword(), PASSWORD_DEFAULT), 'email' => $user->getEmail(), 'status' => $user::DEFAULT_STATUS, 'created' => date("y-m-d"), 'updated' => date("y-m-d"))); }