Skip to content

Commit

Permalink
Merge pull request #680 from govynnus/token-registration
Browse files Browse the repository at this point in the history
Support token authenticated registration
  • Loading branch information
deepbluev7 authored Aug 15, 2021
2 parents 42d2b10 + 0da58c4 commit b1634d6
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/RegisterPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//
// SPDX-License-Identifier: GPL-3.0-or-later

#include <QInputDialog>
#include <QLabel>
#include <QMetaType>
#include <QPainter>
Expand Down Expand Up @@ -481,6 +482,23 @@ RegisterPage::doUIA(const mtx::user_interactive::Unauthorized &unauthorized)
doRegistrationWithAuth(
mtx::user_interactive::Auth{session, mtx::user_interactive::auth::Dummy{}});

} else if (current_stage == mtx::user_interactive::auth_types::registration_token) {
bool ok;
QString token =
QInputDialog::getText(this,
tr("Registration token"),
tr("Please enter a valid registration token."),
QLineEdit::Normal,
QString(),
&ok);

if (ok) {
emit registrationWithAuth(mtx::user_interactive::Auth{
session,
mtx::user_interactive::auth::RegistrationToken{token.toStdString()}});
} else {
emit errorOccurred();
}
} else {
// use fallback
auto dialog = new dialogs::FallbackAuth(
Expand Down

0 comments on commit b1634d6

Please sign in to comment.