mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-06 02:36:38 +00:00
add disconnect button to clients
This commit is contained in:
@@ -51,6 +51,7 @@ export default function CredentialsPage() {
|
|||||||
null
|
null
|
||||||
);
|
);
|
||||||
const [showCredentialsAlert, setShowCredentialsAlert] = useState(false);
|
const [showCredentialsAlert, setShowCredentialsAlert] = useState(false);
|
||||||
|
const [shouldDisconnect, setShouldDisconnect] = useState(true);
|
||||||
|
|
||||||
const { licenseStatus, isUnlocked } = useLicenseStatusContext();
|
const { licenseStatus, isUnlocked } = useLicenseStatusContext();
|
||||||
const subscription = useSubscriptionStatusContext();
|
const subscription = useSubscriptionStatusContext();
|
||||||
@@ -71,7 +72,8 @@ export default function CredentialsPage() {
|
|||||||
const rekeyRes = await api.post(
|
const rekeyRes = await api.post(
|
||||||
`/re-key/${client?.clientId}/regenerate-client-secret`,
|
`/re-key/${client?.clientId}/regenerate-client-secret`,
|
||||||
{
|
{
|
||||||
secret: data.olmSecret
|
secret: data.olmSecret,
|
||||||
|
disconnect: shouldDisconnect
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -180,12 +182,27 @@ export default function CredentialsPage() {
|
|||||||
</SettingsSectionBody>
|
</SettingsSectionBody>
|
||||||
{build !== "oss" && (
|
{build !== "oss" && (
|
||||||
<SettingsSectionFooter>
|
<SettingsSectionFooter>
|
||||||
<Button
|
<div className="flex gap-2">
|
||||||
onClick={() => setModalOpen(true)}
|
<Button
|
||||||
disabled={isSecurityFeatureDisabled()}
|
variant="outline"
|
||||||
>
|
onClick={() => {
|
||||||
{t("regenerateCredentialsButton")}
|
setShouldDisconnect(false);
|
||||||
</Button>
|
setModalOpen(true);
|
||||||
|
}}
|
||||||
|
disabled={isSecurityFeatureDisabled()}
|
||||||
|
>
|
||||||
|
{t("regenerateCredentialsButton")}
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
setShouldDisconnect(true);
|
||||||
|
setModalOpen(true);
|
||||||
|
}}
|
||||||
|
disabled={isSecurityFeatureDisabled()}
|
||||||
|
>
|
||||||
|
{t("clientRegenerateAndDisconnect")}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</SettingsSectionFooter>
|
</SettingsSectionFooter>
|
||||||
)}
|
)}
|
||||||
</SettingsSection>
|
</SettingsSection>
|
||||||
@@ -204,11 +221,38 @@ export default function CredentialsPage() {
|
|||||||
}}
|
}}
|
||||||
dialog={
|
dialog={
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<p>{t("regenerateCredentialsConfirmation")}</p>
|
{shouldDisconnect ? (
|
||||||
<p>{t("regenerateCredentialsWarning")}</p>
|
<>
|
||||||
|
<p>
|
||||||
|
{t(
|
||||||
|
"clientRegenerateAndDisconnectConfirmation"
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{t(
|
||||||
|
"clientRegenerateAndDisconnectWarning"
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<p>
|
||||||
|
{t(
|
||||||
|
"clientRegenerateCredentialsConfirmation"
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{t("clientRegenerateCredentialsWarning")}
|
||||||
|
</p>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
buttonText={t("regenerateCredentialsButton")}
|
buttonText={
|
||||||
|
shouldDisconnect
|
||||||
|
? t("clientRegenerateAndDisconnect")
|
||||||
|
: t("regenerateCredentialsButton")
|
||||||
|
}
|
||||||
onConfirm={handleConfirmRegenerate}
|
onConfirm={handleConfirmRegenerate}
|
||||||
string={getConfirmationString()}
|
string={getConfirmationString()}
|
||||||
title={t("regenerateCredentials")}
|
title={t("regenerateCredentials")}
|
||||||
|
|||||||
Reference in New Issue
Block a user