This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
components/structures/auth Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
2828} from '../../../stores/SetupEncryptionStore' ;
2929import SetupEncryptionBody from "./SetupEncryptionBody" ;
3030import { replaceableComponent } from "../../../utils/replaceableComponent" ;
31+ import SecurityCustomisations from "../../../customisations/Security" ;
3132
3233@replaceableComponent ( "structures.auth.CompleteSecurity" )
3334export default class CompleteSecurity extends React . Component {
@@ -45,6 +46,13 @@ export default class CompleteSecurity extends React.Component {
4546
4647 _onStoreUpdate = ( ) => {
4748 const store = SetupEncryptionStore . sharedInstance ( ) ;
49+
50+ // Skip "you're done" phase if the UI isn't shown
51+ if ( store . phase === PHASE_DONE && SecurityCustomisations . SHOW_ENCRYPTION_SETUP_UI === false ) {
52+ this . props . onFinished ( true ) ;
53+ return ;
54+ }
55+
4856 this . setState ( { phase : store . phase } ) ;
4957 } ;
5058
@@ -61,7 +69,9 @@ export default class CompleteSecurity extends React.Component {
6169 let icon ;
6270 let title ;
6371
64- if ( phase === PHASE_LOADING ) {
72+ // If the encryption UI is hidden then we can simply return nothing - the UI doesn't
73+ // need to be running in order to set up encryption with the SecurityCustomisations.
74+ if ( phase === PHASE_LOADING || SecurityCustomisations . SHOW_ENCRYPTION_SETUP_UI === false ) {
6575 return null ;
6676 } else if ( phase === PHASE_INTRO ) {
6777 icon = < span className = "mx_CompleteSecurity_headerIcon mx_E2EIcon_warning" /> ;
Original file line number Diff line number Diff 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 ;
You can’t perform that action at this time.
0 commit comments