mirror of https://github.com/nextcloud/desktop
Fix credentialstore on startup, promote credentials back on setup.
This fixes https://github.com/owncloud/mirall/issues/81
This commit is contained in:
parent
c5739b4d53
commit
01e8c9dbbe
|
@ -144,4 +144,11 @@ QByteArray CredentialStore::basicAuthHeader() const
|
|||
return data;
|
||||
}
|
||||
|
||||
void CredentialStore::setCredentials( const QString& user, const QString& pwd )
|
||||
{
|
||||
_passwd = pwd;
|
||||
_user = user;
|
||||
_state = Ok;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -72,6 +72,16 @@ public:
|
|||
* @return the singleton pointer to access the object.
|
||||
*/
|
||||
static CredentialStore *instance();
|
||||
|
||||
/**
|
||||
* @brief setCredentials - sets the user credentials.
|
||||
*
|
||||
* This function is called from the setup wizard to set the credentials
|
||||
* int this store. The function also sets the state to ok.
|
||||
* @param user - the user name
|
||||
* @param password - the password.
|
||||
*/
|
||||
void setCredentials( const QString&, const QString& );
|
||||
signals:
|
||||
/**
|
||||
* @brief fetchCredentialsFinished
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "mirall/mirallconfigfile.h"
|
||||
#include "mirall/owncloudtheme.h"
|
||||
#include "mirall/miralltheme.h"
|
||||
#include "mirall/credentialstore.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
|
@ -29,7 +30,6 @@
|
|||
|
||||
namespace Mirall {
|
||||
|
||||
QString MirallConfigFile::_passwd;
|
||||
QString MirallConfigFile::_oCVersion;
|
||||
bool MirallConfigFile::_askedUser = false;
|
||||
|
||||
|
@ -151,10 +151,12 @@ void MirallConfigFile::writeOwncloudConfig( const QString& connection,
|
|||
settings.setValue( QLatin1String("passwd"), QVariant(pwdba.toBase64()) );
|
||||
settings.setValue( QLatin1String("nostoredpassword"), QVariant(skipPwd) );
|
||||
settings.sync();
|
||||
|
||||
// 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( user, pwd );
|
||||
|
||||
}
|
||||
|
||||
// set the url, called from redirect handling.
|
||||
|
|
|
@ -113,7 +113,6 @@ private:
|
|||
|
||||
|
||||
private:
|
||||
static QString _passwd;
|
||||
static bool _askedUser;
|
||||
static QString _oCVersion;
|
||||
QString _customHandle;
|
||||
|
|
Loading…
Reference in New Issue