public function authenticate(Authenticatable $user, array $credentials)
    {

        $handler = ldap_connect($this->host);

        if (! $handler) {
            throw new RuntimeException("Connection fail! Check your server address: '{$this->host}'.");
        }

        try {
            ldap_set_option($handler, LDAP_OPT_PROTOCOL_VERSION, 3);
        } catch (\ErrorException $e) {
            ;
        }

        $username = strtok($user->email, '@');

        $rdn = $this->makeRdn($username);

        try {
            $bind = ldap_bind($handler, $rdn, $credentials['password']);
        } catch (\ErrorException $e) {
            $bind = false;
        }

        if ($handler) {
            ldap_close($handler);

            unset($handler);
        }

        if ($bind) {
            $user->save();
        }

        return $bind;
    }