Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 8aa4b1a

Browse files
authored
Merge pull request #5834 from matrix-org/travis/sponsored/security-disable-ui
Add ability to hide post-login encryption setup with customisation point
2 parents ae2082b + 1e55158 commit 8aa4b1a

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/components/structures/MatrixChat.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ import {replaceableComponent} from "../../utils/replaceableComponent";
8484
import RoomListStore from "../../stores/room-list/RoomListStore";
8585
import {RoomUpdateCause} from "../../stores/room-list/models";
8686
import defaultDispatcher from "../../dispatcher/dispatcher";
87+
import SecurityCustomisations from "../../customisations/Security";
8788

8889
/** constants for MatrixChat.state.view */
8990
export enum Views {
@@ -395,7 +396,11 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
395396

396397
const crossSigningIsSetUp = cli.getStoredCrossSigningForUser(cli.getUserId());
397398
if (crossSigningIsSetUp) {
398-
this.setStateForNewView({ view: Views.COMPLETE_SECURITY });
399+
if (SecurityCustomisations.SHOW_ENCRYPTION_SETUP_UI === false) {
400+
this.onLoggedIn();
401+
} else {
402+
this.setStateForNewView({view: Views.COMPLETE_SECURITY});
403+
}
399404
} else if (await cli.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing")) {
400405
this.setStateForNewView({ view: Views.E2E_SETUP });
401406
} else {

src/customisations/Security.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,20 @@ export interface ISecurityCustomisations {
7474
catchAccessSecretStorageError?: typeof catchAccessSecretStorageError,
7575
setupEncryptionNeeded?: typeof setupEncryptionNeeded,
7676
getDehydrationKey?: typeof getDehydrationKey,
77+
78+
/**
79+
* When false, disables the post-login UI from showing. If there's
80+
* an error during setup, that will be shown to the user.
81+
*
82+
* Note: when this is set to false then the app will assume the user's
83+
* encryption is set up some other way which would circumvent the default
84+
* UI, such as by presenting alternative UI.
85+
*/
86+
SHOW_ENCRYPTION_SETUP_UI?: boolean, // default true
7787
}
7888

7989
// A real customisation module will define and export one or more of the
8090
// customisation points that make up `ISecurityCustomisations`.
81-
export default {} as ISecurityCustomisations;
91+
export default {
92+
SHOW_ENCRYPTION_SETUP_UI: true,
93+
} as ISecurityCustomisations;

0 commit comments

Comments
 (0)