From cbcbda6d4c6ce50c2a88c7b2c84e5d7934ddde99 Mon Sep 17 00:00:00 2001 From: Luna <93695520+LunaisLazier@users.noreply.github.com> Date: Sat, 11 Jan 2025 14:11:12 -0600 Subject: [PATCH] revert auth parent changes --- launcher/minecraft/auth/AuthFlow.cpp | 2 +- launcher/minecraft/auth/AuthFlow.h | 5 ++++- launcher/minecraft/auth/MinecraftAccount.cpp | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/launcher/minecraft/auth/AuthFlow.cpp b/launcher/minecraft/auth/AuthFlow.cpp index 3207cd87e..c3a159197 100644 --- a/launcher/minecraft/auth/AuthFlow.cpp +++ b/launcher/minecraft/auth/AuthFlow.cpp @@ -21,7 +21,7 @@ #include -AuthFlow::AuthFlow(AccountData* data, Action action) : Task(), m_data(data) +AuthFlow::AuthFlow(AccountData* data, Action action, QObject* parent, const std::optional password) : Task(parent), m_data(data) { if (data->type == AccountType::MSA) { if (action == Action::DeviceCode) { diff --git a/launcher/minecraft/auth/AuthFlow.h b/launcher/minecraft/auth/AuthFlow.h index 46d07fd06..a5aea9fa1 100644 --- a/launcher/minecraft/auth/AuthFlow.h +++ b/launcher/minecraft/auth/AuthFlow.h @@ -18,7 +18,10 @@ class AuthFlow : public Task { public: enum class Action { Refresh, Login, DeviceCode }; - explicit AuthFlow(AccountData* data, Action action = Action::Refresh); + explicit AuthFlow(AccountData* data, + Action action = Action::Refresh, + QObject* parent = 0, + std::optional password = std::nullopt); virtual ~AuthFlow() = default; void executeTask() override; diff --git a/launcher/minecraft/auth/MinecraftAccount.cpp b/launcher/minecraft/auth/MinecraftAccount.cpp index dbd01c844..ea4331c2c 100644 --- a/launcher/minecraft/auth/MinecraftAccount.cpp +++ b/launcher/minecraft/auth/MinecraftAccount.cpp @@ -138,7 +138,7 @@ shared_qobject_ptr MinecraftAccount::login(bool useDeviceCode, std::op { Q_ASSERT(m_currentTask.get() == nullptr); - m_currentTask.reset(new AuthFlow(&data, useDeviceCode ? AuthFlow::Action::DeviceCode : AuthFlow::Action::Login)); + m_currentTask.reset(new AuthFlow(&data, useDeviceCode ? AuthFlow::Action::DeviceCode : AuthFlow::Action::Login, this, password)); connect(m_currentTask.get(), &Task::succeeded, this, &MinecraftAccount::authSucceeded); connect(m_currentTask.get(), &Task::failed, this, &MinecraftAccount::authFailed); connect(m_currentTask.get(), &Task::aborted, this, [this] { authFailed(tr("Aborted")); }); @@ -152,7 +152,7 @@ shared_qobject_ptr MinecraftAccount::refresh() return m_currentTask; } - m_currentTask.reset(new AuthFlow(&data, AuthFlow::Action::Refresh)); + m_currentTask.reset(new AuthFlow(&data, AuthFlow::Action::Refresh, this)); connect(m_currentTask.get(), &Task::succeeded, this, &MinecraftAccount::authSucceeded); connect(m_currentTask.get(), &Task::failed, this, &MinecraftAccount::authFailed);