Esempio n. 1
0
void CredentialStore::fetchCredentials()
{
    _state = Fetching;
    MirallConfigFile cfgFile;

    if( ++_tries > MAX_LOGIN_ATTEMPTS ) {
        qDebug() << "Too many attempts to enter password!";
        _state = TooManyAttempts;
        return;
    }

    bool ok = false;
    QString pwd;
    _state = Fetching;
    _user = cfgFile.ownCloudUser();

    switch( _type ) {
    case CredentialStore::User: {
        /* Ask the user for the password */
        /* Fixme: Move user interaction out here. */
        pwd = QInputDialog::getText(0, QApplication::translate("MirallConfigFile","Password Required"),
                                    QApplication::translate("MirallConfigFile","Please enter your %1 password:"******"QtKeyChain: Not yet implemented!";
        _state = Error;
#endif
        break;
    }
    default: {
        break;
    }
    }
void ShibbolethCredentials::fetchFromKeychain()
{
    if (_user.isEmpty()) {
        _user = _account->credentialSetting(QLatin1String(userC)).toString();
    }
    if (_ready) {
        Q_EMIT fetched();
    } else {
        _url = _account->url();
        ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName());
        job->setSettings(Utility::settingsWithGroup(Theme::instance()->appName(), job).release());
        job->setInsecureFallback(false);
        job->setKey(keychainKey(_account->url().toString(), "shibAssertion"));
        connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotReadJobDone(QKeychain::Job*)));
        job->start();
    }
}