Skip to content

Commit

Permalink
Refs #95. Added warning when enabled 2FA in user editor
Browse files Browse the repository at this point in the history
  • Loading branch information
SBriere committed Oct 7, 2024
1 parent 25b4c91 commit 572d2a7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/src/editors/TeraForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ void TeraForm::hideField(const QString &field)
setWidgetVisibility(widget, nullptr, false);
checkConditions(widget);
// Disable condition
if (widget->property("condition").isValid() && !hasHookCondition(widget)){
/*if (widget->property("condition").isValid() && !hasHookCondition(widget)){
widget->setProperty("_condition", widget->property("condition"));
widget->setProperty("condition", QVariant());
}
}*/
}
}

Expand All @@ -269,10 +269,10 @@ void TeraForm::showField(const QString &field)
if (widget){
setWidgetVisibility(widget, nullptr, true);
// Enable condition
if (widget->property("_condition").isValid()){
/*if (widget->property("_condition").isValid()){
widget->setProperty("condition", widget->property("_condition"));
widget->setProperty("_condition", QVariant());
}
}*/
checkConditions(widget);
}
}
Expand Down
11 changes: 11 additions & 0 deletions client/src/editors/UserWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,17 @@ void UserWidget::userFormValueChanged(QWidget *widget, QVariant value)
}
}

if (widget == ui->wdgUser->getWidgetForField("user_2fa_enabled")){
if (m_data){
if (value.toBool() && !m_data->getFieldValue("user_2fa_enabled").toBool()){
GlobalMessageBox msgbox;
if (msgbox.showYesNo(tr("Authentification multi-facteurs"),
tr("Activer la double authentification forcera une configuration de l'utilisateur lors de la prochaine connexion.\n\nVoulez-vous continuer?")) == GlobalMessageBox::No){
ui->wdgUser->setFieldValue("user_2fa_enabled", false);
}
}
}
}
if (widget == ui->wdgUser->getWidgetForField("user_2fa_otp_enabled")){
if (m_data){
if (!value.toBool() && m_data->getFieldValue("user_2fa_otp_enabled").toBool()){
Expand Down

0 comments on commit 572d2a7

Please sign in to comment.