mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-12-24 04:22:39 +00:00
Fix Microsoft account provider
This commit is contained in:
@@ -218,6 +218,7 @@ set(MINECRAFT_SOURCES
|
||||
minecraft/auth/providers/DummyAuthProvider.h
|
||||
minecraft/auth/providers/ElybyAuthProvider.h
|
||||
minecraft/auth/providers/MojangAuthProvider.h
|
||||
minecraft/auth/providers/MicrosoftAuthProvider.h
|
||||
|
||||
minecraft/auth/flows/MSAInteractive.h
|
||||
minecraft/auth/flows/MSAInteractive.cpp
|
||||
|
||||
@@ -313,6 +313,7 @@ bool AccountData::resumeStateFromV3(QJsonObject data) {
|
||||
auto typeS = typeV.toString();
|
||||
if(typeS == "MSA") {
|
||||
type = AccountType::MSA;
|
||||
provider = AuthProviders::lookup("MSA");
|
||||
} else {
|
||||
type = AccountType::Mojang;
|
||||
provider = AuthProviders::lookup(typeS);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "providers/ElybyAuthProvider.h"
|
||||
#include "providers/DummyAuthProvider.h"
|
||||
#include "providers/MojangAuthProvider.h"
|
||||
#include "providers/MicrosoftAuthProvider.h"
|
||||
#include "../../AuthServer.h"
|
||||
|
||||
#define REGISTER_AUTH_PROVIDER(Provider) \
|
||||
@@ -20,6 +21,7 @@ namespace AuthProviders
|
||||
REGISTER_AUTH_PROVIDER(ElybyAuthProvider);
|
||||
REGISTER_AUTH_PROVIDER(DummyAuthProvider);
|
||||
REGISTER_AUTH_PROVIDER(MojangAuthProvider);
|
||||
REGISTER_AUTH_PROVIDER(MicrosoftAuthProvider);
|
||||
}
|
||||
|
||||
AuthProviderPtr lookup(QString id)
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "flows/MojangRefresh.h"
|
||||
#include "flows/MojangLogin.h"
|
||||
#include "AuthProviders.h"
|
||||
|
||||
MinecraftAccountPtr MinecraftAccount::loadFromJsonV2(const QJsonObject& json) {
|
||||
MinecraftAccountPtr account(new MinecraftAccount());
|
||||
@@ -63,6 +64,7 @@ MinecraftAccountPtr MinecraftAccount::createBlankMSA()
|
||||
{
|
||||
MinecraftAccountPtr account(new MinecraftAccount());
|
||||
account->data.type = AccountType::MSA;
|
||||
account->setProvider(AuthProviders::lookup("MSA"));
|
||||
return account;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,5 @@ void MSAInteractive::executeTask() {
|
||||
|
||||
beginActivity(Katabasis::Activity::LoggingIn);
|
||||
m_oauth2->unlink();
|
||||
*m_data = AccountData();
|
||||
m_oauth2->link();
|
||||
}
|
||||
|
||||
26
launcher/minecraft/auth/providers/MicrosoftAuthProvider.h
Normal file
26
launcher/minecraft/auth/providers/MicrosoftAuthProvider.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include "QObjectPtr.h"
|
||||
#include <QDateTime>
|
||||
#include <QSet>
|
||||
#include <QProcess>
|
||||
#include <QDebug>
|
||||
|
||||
#include "MojangAuthProvider.h"
|
||||
|
||||
class MicrosoftAuthProvider : public MojangAuthProvider
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QString id()
|
||||
{
|
||||
return "MSA";
|
||||
}
|
||||
|
||||
QString displayName()
|
||||
{
|
||||
return "Microsoft";
|
||||
}
|
||||
};
|
||||
@@ -28,9 +28,13 @@ LoginDialog::LoginDialog(QWidget *parent) : QDialog(parent), ui(new Ui::LoginDia
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
|
||||
for(auto provider: AuthProviders::getAll()) {
|
||||
QRadioButton *button = new QRadioButton(provider->displayName());
|
||||
m_radioButtons[provider->id()] = button;
|
||||
ui->radioLayout->addWidget(button);
|
||||
auto providerId = provider->id();
|
||||
// Exclude Microsoft account from here...
|
||||
if (providerId != "MSA") {
|
||||
QRadioButton *button = new QRadioButton(provider->displayName());
|
||||
m_radioButtons[providerId] = button;
|
||||
ui->radioLayout->addWidget(button);
|
||||
}
|
||||
}
|
||||
m_radioButtons["dummy"]->setChecked(true);
|
||||
adjustSize();
|
||||
|
||||
Reference in New Issue
Block a user