mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Use two step process to store credentials through config file.
This commit is contained in:
parent
9c627782d4
commit
edfefabcf8
@ -162,8 +162,8 @@ void MirallConfigFile::writeOwncloudConfig( const QString& connection,
|
||||
// check the perms, only read-write for the owner.
|
||||
QFile::setPermissions( file, QFile::ReadOwner|QFile::WriteOwner );
|
||||
|
||||
// inform the credential store about the password change.
|
||||
CredentialStore::instance()->setCredentials( cloudsUrl, user, pwd, skipPwd );
|
||||
// Store credentials temporar until the config is finalized.
|
||||
CredentialStore::instance()->setCredentials( cloudsUrl, user, passwd );
|
||||
|
||||
}
|
||||
|
||||
@ -451,6 +451,7 @@ void MirallConfigFile::acceptCustomConfig()
|
||||
}
|
||||
|
||||
QString srcConfig = configFile(); // this considers the custom handle
|
||||
|
||||
_customHandle.clear();
|
||||
QString targetConfig = configFile();
|
||||
QString targetBak = targetConfig + QLatin1String(".bak");
|
||||
@ -471,6 +472,9 @@ void MirallConfigFile::acceptCustomConfig()
|
||||
}
|
||||
}
|
||||
QFile::remove( targetBak );
|
||||
|
||||
// inform the credential store about the password change.
|
||||
CredentialStore::instance()->saveCredentials( );
|
||||
}
|
||||
|
||||
QVariant MirallConfigFile::customMedia( customMediaType type )
|
||||
|
||||
@ -116,6 +116,7 @@ private:
|
||||
static bool _askedUser;
|
||||
static QString _oCVersion;
|
||||
QString _customHandle;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
#include "mirall/mirallconfigfile.h"
|
||||
#include "mirall/owncloudinfo.h"
|
||||
#include "mirall/folderman.h"
|
||||
#include "mirall/credentialstore.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QProcess>
|
||||
@ -392,16 +391,18 @@ void OwncloudSetupWizard::setupLocalSyncFolder()
|
||||
|
||||
if( localFolderOk ) {
|
||||
_remoteFolder = Theme::instance()->defaultServerFolder();
|
||||
CredentialStore::instance()->reset();
|
||||
connect( CredentialStore::instance(), SIGNAL(fetchCredentialsFinished(int)),
|
||||
this, SLOT(slotCreateRemoteFolder(int)));
|
||||
CredentialStore::instance()->fetchCredentials();
|
||||
slotCreateRemoteFolder(true);
|
||||
}
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::slotCreateRemoteFolder(int res)
|
||||
void OwncloudSetupWizard::slotCreateRemoteFolder(bool credentialsOk )
|
||||
{
|
||||
disconnect(CredentialStore::instance(), SIGNAL(fetchCredentialsFinished(bool)));
|
||||
if( ! credentialsOk ) {
|
||||
// User pressed cancel while being asked for password.
|
||||
_ocWizard->appendToResultWidget("User canceled password dialog. Can not connect.");
|
||||
return;
|
||||
}
|
||||
|
||||
if( createRemoteFolder( _remoteFolder ) ) {
|
||||
qDebug() << "Started remote folder creation ok";
|
||||
} else {
|
||||
|
||||
@ -80,7 +80,7 @@ protected slots:
|
||||
void slotConnectToOCUrl( const QString& );
|
||||
void slotCreateOCLocalhost();
|
||||
|
||||
void slotCreateRemoteFolder(int);
|
||||
void slotCreateRemoteFolder(bool);
|
||||
|
||||
private slots:
|
||||
void slotOwnCloudFound( const QString&, const QString&, const QString&, const QString& );
|
||||
|
||||
Loading…
Reference in New Issue
Block a user