Commit 2a974269 authored by Ilia Kats's avatar Ilia Kats
Browse files

OpenConnect: don't present an empty form to the user

Apparently, if token authentication is enabled and the secret stored,
OpenConnect autofills the token and presents an empty form to us, in
which no fields are present and only the login button must be clicked.
This commit prevents display of empty forms.
parent 2876e7f3
......@@ -512,15 +512,6 @@ void OpenconnectAuthWidget::processAuthForm(struct oc_auth_form *form)
Q_D(OpenconnectAuthWidget);
deleteAllFromLayout(d->ui.loginBoxLayout);
if (form->banner) {
addFormInfo(QLatin1String("dialog-information"), form->banner);
}
if (form->message) {
addFormInfo(QLatin1String("dialog-information"), form->message);
}
if (form->error) {
addFormInfo(QLatin1String("dialog-error"), form->error);
}
struct oc_form_opt *opt;
QFormLayout *layout = new QFormLayout();
......@@ -581,6 +572,22 @@ void OpenconnectAuthWidget::processAuthForm(struct oc_auth_form *form)
layout->addRow(text, widget);
}
}
if (!layout->rowCount()) {
delete layout;
d->workerWaiting.wakeAll();
return;
}
if (form->banner) {
addFormInfo(QLatin1String("dialog-information"), form->banner);
}
if (form->message) {
addFormInfo(QLatin1String("dialog-information"), form->message);
}
if (form->error) {
addFormInfo(QLatin1String("dialog-error"), form->error);
}
d->ui.loginBoxLayout->addLayout(layout);
d->passwordFormIndex = d->ui.loginBoxLayout->count() - 1;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment