2019-07-24 14:56:21 +03:00
|
|
|
#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
|
|
|
|
*/
|
2022-10-24 17:00:50 +03:00
|
|
|
void authorized(OCC::AccountState*);
|
2019-07-24 14:56:21 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2022-10-24 17:00:50 +03:00
|
|
|
void notifyServerSuccessJob(OCC::AccountState *accountState, bool);
|
2019-07-24 14:56:21 +03:00
|
|
|
void notifyServerSuccessJobSlot();
|
|
|
|
|
|
|
|
private:
|
|
|
|
AccountPtr _account;
|
|
|
|
QString _appPassword;
|
2023-02-06 12:38:59 +03:00
|
|
|
bool _accountRemoved = false;
|
2019-07-24 14:56:21 +03:00
|
|
|
QNetworkAccessManager _networkManager;
|
2023-02-06 12:38:59 +03:00
|
|
|
QNetworkReply *_networkReplyCheck = nullptr;
|
|
|
|
QNetworkReply *_networkReplySuccess = nullptr;
|
2019-07-24 14:56:21 +03:00
|
|
|
|
|
|
|
friend class ::TestRemoteWipe;
|
|
|
|
};
|
|
|
|
}
|
2022-10-24 17:00:50 +03:00
|
|
|
#endif // REMOTEWIPE_H
|