public static function authenticate(array $credentials, $remember = false)
    {
        $username = $credentials['username'];
        $password = $credentials['password'];

        $authConfig = getConfigPath('app', 'auth');

        $user = static::user($authConfig, $username);

        /*
         * if authentication requires email activation, we check the database using data provided
         * by the developer data = ['column_name' => 'activation_value'] e.g. [ 'activated' => 1 ]
         */
        if ($user && count($authConfig['activation']) &&
            !static::activated($authConfig['activation'], $user)) {
            return static::NOT_ACTIVATED;
        }

        /*
         * check for password
         */
        if (!verify_secret($password, $user->password)) {
            return static::BAD_CREDENTIALS;
        }

        /**
         * Log in user.
         */
        static::setLoginSession($authConfig, $user);

        /*
         * Remember the user
         */
        if ($remember) {
            static::rememberMe($authConfig, $user);
        }

        return static::VALID;
    }