public function isCorrect($iUserId, $sPassword)
    {
        if (empty($iUserId) || empty($sPassword)) {
            return false;
        }

        // --------------------------------------------------------------------------

        $oDb = Factory::service('Database');
        $oDb->select('u.password, u.password_engine, u.salt');
        $oDb->where('u.id', $iUserId);
        $oDb->limit(1);
        $oResult = $oDb->get(NAILS_DB_PREFIX . 'user u');

        // --------------------------------------------------------------------------

        if ($oResult->num_rows() !== 1) {
            return false;
        }

        // --------------------------------------------------------------------------

        /**
         * @todo: use the appropriate driver to determine password correctness, but
         * for now, do it the old way
         */

        $sHash = sha1(sha1($sPassword) . $oResult->row()->salt);

        return $oResult->row()->password === $sHash;
    }