mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-12 18:20:28 +03:00
deep-link cross-signing reset button with oidc
This commit is contained in:
parent
5926cc02d4
commit
d064ae74fa
2 changed files with 34 additions and 0 deletions
|
|
@ -32,6 +32,9 @@ import {
|
||||||
DeviceVerificationSetup,
|
DeviceVerificationSetup,
|
||||||
} from '../../../components/DeviceVerificationSetup';
|
} from '../../../components/DeviceVerificationSetup';
|
||||||
import { stopPropagation } from '../../../utils/keyboard';
|
import { stopPropagation } from '../../../utils/keyboard';
|
||||||
|
import { useAuthMetadata } from '../../../hooks/useAuthMetaData';
|
||||||
|
import { withSearchParam } from '../../../pages/pathUtils';
|
||||||
|
import { useAccountManagementActions } from '../../../hooks/useAccountManagement';
|
||||||
|
|
||||||
type VerificationStatusBadgeProps = {
|
type VerificationStatusBadgeProps = {
|
||||||
verificationStatus: VerificationStatus;
|
verificationStatus: VerificationStatus;
|
||||||
|
|
@ -252,6 +255,8 @@ export function EnableVerification({ visible }: EnableVerificationProps) {
|
||||||
|
|
||||||
export function DeviceVerificationOptions() {
|
export function DeviceVerificationOptions() {
|
||||||
const [menuCords, setMenuCords] = useState<RectCords>();
|
const [menuCords, setMenuCords] = useState<RectCords>();
|
||||||
|
const authMetadata = useAuthMetadata();
|
||||||
|
const accountManagementActions = useAccountManagementActions();
|
||||||
|
|
||||||
const [reset, setReset] = useState(false);
|
const [reset, setReset] = useState(false);
|
||||||
|
|
||||||
|
|
@ -265,6 +270,18 @@ export function DeviceVerificationOptions() {
|
||||||
|
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
setMenuCords(undefined);
|
setMenuCords(undefined);
|
||||||
|
|
||||||
|
if (authMetadata) {
|
||||||
|
const authUrl = authMetadata.account_management_uri ?? authMetadata.issuer;
|
||||||
|
window.open(
|
||||||
|
withSearchParam(authUrl, {
|
||||||
|
action: accountManagementActions.crossSigningReset,
|
||||||
|
}),
|
||||||
|
'_blank'
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setReset(true);
|
setReset(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
17
src/app/hooks/useAccountManagement.ts
Normal file
17
src/app/hooks/useAccountManagement.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
|
export const useAccountManagementActions = () => {
|
||||||
|
const actions = useMemo(
|
||||||
|
() => ({
|
||||||
|
profile: 'org.matrix.profile',
|
||||||
|
sessionsList: 'org.matrix.sessions_list',
|
||||||
|
sessionView: 'org.matrix.session_view',
|
||||||
|
sessionEnd: 'org.matrix.session_end',
|
||||||
|
accountDeactivate: 'org.matrix.account_deactivate',
|
||||||
|
crossSigningReset: 'org.matrix.cross_signing_reset',
|
||||||
|
}),
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
return actions;
|
||||||
|
};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue