diff --git a/src/dashboard/Dashboard.scss b/src/dashboard/Dashboard.scss
index ad3f76a22..5fda6a378 100644
--- a/src/dashboard/Dashboard.scss
+++ b/src/dashboard/Dashboard.scss
@@ -21,6 +21,27 @@ body:global(.sidebarCollapsed) {
}
}
+// Floating so it doesn't shift page layout; stays below modals/popovers (z-index 1001).
+.masterKeyRotatedAlert {
+ position: fixed;
+ right: 24px;
+ bottom: 24px;
+ max-width: 420px;
+ z-index: 999;
+
+ > div {
+ margin-bottom: 0;
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
+ }
+
+ @media (max-width: 600px) {
+ left: 16px;
+ right: 16px;
+ bottom: 16px;
+ max-width: none;
+ }
+}
+
.loadingError {
font-size: 58px;
diff --git a/src/dashboard/DashboardView.react.js b/src/dashboard/DashboardView.react.js
index ae241706d..485c45949 100644
--- a/src/dashboard/DashboardView.react.js
+++ b/src/dashboard/DashboardView.react.js
@@ -20,6 +20,8 @@ import { canAccess } from 'lib/serverInfo';
import { openConnect } from 'dashboard/Data/AppOverview/connectEvents';
import PlanUsageBadge from 'components/Sidebar/PlanUsageBadge.react';
import { PlugIcon } from 'dashboard/Data/AppOverview/connectIcons.react';
+import B4AAlert from 'components/B4AAlert/B4AAlert.react';
+import { Link } from 'react-router-dom';
// Alert parameters
const MySwal = withReactContent(Swal);
@@ -488,10 +490,31 @@ export default class DashboardView extends React.Component {
// );
// }
+ let masterKeyRotatedAlert = null;
+ if (this.context.showMasterKeyRotatedAlert) {
+ masterKeyRotatedAlert = (
+
+
+ As a security precaution, we rotated this app's Master Key. The new key is already available in{' '}
+ App Settings > Security & Keys.
+ >
+ }
+ handlerCloseEvent={() => {
+ this.context.dismissMasterKeyRotatedAlert().catch(() => {});
+ }}
+ />
+
+ );
+ }
+
return (
{content}
{sidebar}
+ {masterKeyRotatedAlert}
);
}
diff --git a/src/lib/ParseApp.js b/src/lib/ParseApp.js
index e1d399978..563b4d778 100644
--- a/src/lib/ParseApp.js
+++ b/src/lib/ParseApp.js
@@ -63,6 +63,7 @@ export default class ParseApp {
databaseType,
databaseVersion,
isMongoUpgradeAvailable,
+ showMasterKeyRotatedAlert,
region
}) {
this.name = appName;
@@ -104,6 +105,7 @@ export default class ParseApp {
this.region = region;
this.databaseVersion = databaseVersion;
this.isMongoUpgradeAvailable = isMongoUpgradeAvailable;
+ this.showMasterKeyRotatedAlert = showMasterKeyRotatedAlert === true;
if (!supportedPushLocales) {
console.warn('Missing push locales for \'' + appName + '\', see this link for details on setting localizations up. https://github.com/parse-community/parse-dashboard#configuring-localized-push-notifications');
}
@@ -436,6 +438,14 @@ export default class ParseApp {
return AJAX.post(path);
}
+ // Cleared in memory first so the alert doesn't come back when DashboardView remounts on route change.
+ dismissMasterKeyRotatedAlert() {
+ this.showMasterKeyRotatedAlert = false;
+ // eslint-disable-next-line no-undef
+ const path = `${b4aSettings.BACK4APP_API_PATH}/parse-app/${this.slug}/master-key-rotated-alert/dismiss`;
+ return AJAX.post(path);
+ }
+
transferApp(newOwner) {
const path = `/parse-app/${this.slug}/transfer`;
return AJAX.post(path, { newOwner });