Esempio n. 1
0
void RtspSocket::slotAuthenticationRequired ( QNetworkReply * , QAuthenticator * authenticator )
{
    QDEBUG << tr("User: ")+authenticator->user();
    if( !authenticator->user().isEmpty() )
    {
        if( authenticator->user() == _url.userName() && authenticator->password() == _url.password() )
        {
            _url.setUserName(DEFAULT_USERNAME);
            _url.setPassword(DEFAULT_PASSWORD);
        } else
        {
            Authentication auth;
            auth.setValues(_url.userName(), _url.password(), false);
            auth.show();
            if( auth.exec() )
            {
                _url.setUserName(auth.getUser());
                _url.setPassword(auth.getPass());
            }
        }
    }
    authenticator->setUser(_url.userName());
    authenticator->setPassword(_url.password());
}