Disallow editing of secret keys

This commit is contained in:
Loporrit
2023-12-03 16:34:39 +00:00
parent c9a9765838
commit 74e6d360aa

View File

@@ -1048,12 +1048,15 @@ public class SettingsUi : WindowMediatorSubscriberBase
_serverConfigurationManager.Save();
}
var key = item.Value.Key;
var keyInUse = selectedServer.Authentications.Exists(p => p.SecretKeyIdx == item.Key);
if (keyInUse) ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudGrey3);
if (ImGui.InputText("Secret Key", ref key, 64))
{
item.Value.Key = key;
_serverConfigurationManager.Save();
}
if (!selectedServer.Authentications.Exists(p => p.SecretKeyIdx == item.Key))
if (keyInUse) ImGui.PopStyleColor();
if (!keyInUse)
{
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Delete Secret Key") && UiSharedService.CtrlPressed())
{
@@ -1064,7 +1067,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
else
{
UiSharedService.ColorTextWrapped("This key is in use and cannot be deleted", ImGuiColors.DalamudYellow);
UiSharedService.ColorTextWrapped("This key is in use and cannot be edited or deleted", ImGuiColors.DalamudYellow);
}
if (item.Key != selectedServer.SecretKeys.Keys.LastOrDefault())