This repository was archived by the owner on Sep 10, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,15 @@ import { graphql } from "../gql";
28
28
29
29
import { CURRENT_VIEWER_QUERY } from "./reset-cross-signing" ;
30
30
31
+ declare global {
32
+ interface Window {
33
+ // Synapse may fling the user here via UIA fallback,
34
+ // this is part of the API to signal completion to the calling client
35
+ // https://spec.matrix.org/v1.11/client-server-api/#fallback
36
+ onAuthDone ?( ) : void ;
37
+ }
38
+ }
39
+
31
40
const ALLOW_CROSS_SIGING_RESET_MUTATION = graphql ( /* GraphQL */ `
32
41
mutation AllowCrossSigningReset($userId: ID!) {
33
42
allowUserCrossSigningReset(input: { userId: $userId }) {
@@ -52,8 +61,18 @@ function ResetCrossSigning(): React.ReactNode {
52
61
53
62
const [ result , allowReset ] = useMutation ( ALLOW_CROSS_SIGING_RESET_MUTATION ) ;
54
63
55
- const onClick = ( ) : void => {
56
- allowReset ( { userId } ) ;
64
+ const onClick = async ( ) : Promise < void > => {
65
+ await allowReset ( { userId } ) ;
66
+ setTimeout ( ( ) => {
67
+ // Synapse may fling the user here via UIA fallback,
68
+ // this is part of the API to signal completion to the calling client
69
+ // https://spec.matrix.org/v1.11/client-server-api/#fallback
70
+ if ( window . onAuthDone ) {
71
+ window . onAuthDone ( ) ;
72
+ } else if ( window . opener && window . opener . postMessage ) {
73
+ window . opener . postMessage ( "authDone" , "*" ) ;
74
+ }
75
+ } ) ;
57
76
} ;
58
77
59
78
return (
You can’t perform that action at this time.
0 commit comments