mirror of
https://github.com/nextcloud/desktop.git
synced 2024-12-22 13:44:34 +03:00
19491ff85f
- When the the users logs because of 401 or 403 errors, it checks if the server requested the remote wipe. If yes, locally deletes account and folders connected to the account and notify the server. If no, proceeds to ask the user to login again. - The app password is restored in the keychain. - WIP: The change also includes a test class for RemoteWipe. Signed-off-by: Camila San <hello@camila.codes>
61 lines
No EOL
1.3 KiB
C++
61 lines
No EOL
1.3 KiB
C++
#ifndef REMOTEWIPE_H
|
|
#define REMOTEWIPE_H
|
|
|
|
#include "accountmanager.h"
|
|
#include <QNetworkAccessManager>
|
|
|
|
class QJsonDocument;
|
|
class TestRemoteWipe;
|
|
|
|
namespace OCC {
|
|
|
|
class RemoteWipe : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit RemoteWipe(AccountPtr account, QObject *parent = nullptr);
|
|
|
|
signals:
|
|
/**
|
|
* Notify if wipe was requested
|
|
*/
|
|
void authorized(AccountState*);
|
|
|
|
/**
|
|
* Notify if user only needs to login again
|
|
*/
|
|
void askUserCredentials();
|
|
|
|
public slots:
|
|
/**
|
|
* Once receives a 401 or 403 status response it will do a fetch to
|
|
* <server>/index.php/core/wipe/check
|
|
*/
|
|
void startCheckJobWithAppPassword(QString);
|
|
|
|
private slots:
|
|
/**
|
|
* If wipe is requested, delete account and data, if not continue by asking
|
|
* the user to login again
|
|
*/
|
|
void checkJobSlot();
|
|
|
|
/**
|
|
* Once the client has wiped all the required data a POST to
|
|
* <server>/index.php/core/wipe/success
|
|
*/
|
|
void notifyServerSuccessJob(AccountState *accountState, bool);
|
|
void notifyServerSuccessJobSlot();
|
|
|
|
private:
|
|
AccountPtr _account;
|
|
QString _appPassword;
|
|
bool _accountRemoved;
|
|
QNetworkAccessManager _networkManager;
|
|
QNetworkReply *_networkReplyCheck;
|
|
QNetworkReply *_networkReplySuccess;
|
|
|
|
friend class ::TestRemoteWipe;
|
|
};
|
|
}
|
|
#endif // REMOTEWIPE_H
|