Skip to content

Commit

Permalink
Add support for 2FA on ely.by accounts (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
fn2006 authored Jun 9, 2023
1 parent cc85b44 commit 392822e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion launcher/minecraft/auth/steps/ElybyStep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void ElybyStep::onAuthFailed() {
// NOTE: soft error in the first step means 'offline'
if(state == AccountTaskState::STATE_FAILED_SOFT) {
state = AccountTaskState::STATE_OFFLINE;
errorMessage = tr("Ely.by user authentication ended with a network error.");
errorMessage = tr("Ely.by user authentication ended with a network error.\nIf you are using 2FA make sure to enter your auth code.");
}
emit finished(state, errorMessage);
}
8 changes: 7 additions & 1 deletion launcher/ui/dialogs/ElybyLoginDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ void ElybyLoginDialog::accept()

// Setup the login task and start it
m_account = MinecraftAccount::createElyby(ui->userTextBox->text());
m_loginTask = m_account->loginElyby(ui->passTextBox->text());
if (ui->mfaTextBox->text().length() > 0) {
m_loginTask = m_account->loginElyby(ui->passTextBox->text() + ':' + ui->mfaTextBox->text());
}
else {
m_loginTask = m_account->loginElyby(ui->passTextBox->text());
}
connect(m_loginTask.get(), &Task::failed, this, &ElybyLoginDialog::onTaskFailed);
connect(m_loginTask.get(), &Task::succeeded, this, &ElybyLoginDialog::onTaskSucceeded);
connect(m_loginTask.get(), &Task::status, this, &ElybyLoginDialog::onTaskStatus);
Expand All @@ -55,6 +60,7 @@ void ElybyLoginDialog::setUserInputsEnabled(bool enable)
{
ui->userTextBox->setEnabled(enable);
ui->passTextBox->setEnabled(enable);
ui->mfaTextBox->setEnabled(enable);
ui->buttonBox->setEnabled(enable);
}

Expand Down
10 changes: 10 additions & 0 deletions launcher/ui/dialogs/ElybyLoginDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mfaTextBox">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
<property name="placeholderText">
<string>2FA Code (Optional)</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="value">
Expand Down

0 comments on commit 392822e

Please sign in to comment.