mirror of
https://github.com/laurent22/joplin.git
synced 2025-02-01 19:15:01 +02:00
Auto-generate client ID
This commit is contained in:
parent
e16122d978
commit
5c7581ae1d
@ -37,6 +37,11 @@ Application::Application(int &argc, char **argv) :
|
||||
|
||||
Settings settings;
|
||||
|
||||
if (!settings.contains("clientId")) {
|
||||
// Client ID should be unique per instance of a program
|
||||
settings.setValue("clientId", uuid::createUuid());
|
||||
}
|
||||
|
||||
view_.setResizeMode(QQuickView::SizeRootObjectToView);
|
||||
QQmlContext *ctxt = view_.rootContext();
|
||||
ctxt->setContextProperty("folderListModel", &folderModel_);
|
||||
@ -88,17 +93,14 @@ Application::Application(int &argc, char **argv) :
|
||||
}
|
||||
|
||||
void Application::login(const QString &email, const QString &password) {
|
||||
Settings settings;
|
||||
QUrlQuery postData;
|
||||
postData.addQueryItem("email", email);
|
||||
postData.addQueryItem("password", password);
|
||||
postData.addQueryItem("client_id", clientId());
|
||||
postData.addQueryItem("client_id", settings.value("clientId").toString());
|
||||
api_.post("sessions", QUrlQuery(), postData, "getSession");
|
||||
}
|
||||
|
||||
QString Application::clientId() const {
|
||||
return "2222222222222222";
|
||||
}
|
||||
|
||||
void Application::api_requestDone(const QJsonObject& response, const QString& tag) {
|
||||
// TODO: handle errors
|
||||
// Handle expired sessions
|
||||
|
@ -22,7 +22,6 @@ public:
|
||||
|
||||
Application(int &argc, char **argv);
|
||||
void login(const QString& email, const QString& password);
|
||||
QString clientId() const;
|
||||
|
||||
private:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user