File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 <Button @click =" doTest2faCall " >
2121 Test 2FA API Call
2222 </Button >
23+
24+ <Button @click =" get2FaConfirmationResultWindow " >
25+ 2fa window.get2FaConfirmationResult (global window api)
26+ </Button >
27+ <Button @click =" get2FaConfirmationResultTwoFactorsAuth " >
28+ 2fa twoFactorsAuth.get2FaConfirmationResult
29+ </Button >
2330 </div >
2431</template >
2532
@@ -32,7 +39,9 @@ import { callApi } from '@/utils';
3239
3340const { alert } = useAdminforth ();
3441import adminforth from ' @/adminforth' ;
42+ import { useTwoFactorsAuth } from ' @/custom/plugins/TwoFactorsAuthPlugin/use2faApi.ts' ;
3543
44+ const twoFactorsAuth = useTwoFactorsAuth ();
3645
3746const valueStart = ref ()
3847
@@ -89,4 +98,14 @@ async function doTest2faCall() {
8998 console .error (' 2FA API error:' , error );
9099 }
91100}
101+
102+ async function get2FaConfirmationResultWindow() {
103+ const verificationResult = await window .adminforthTwoFaModal .get2FaConfirmationResult (); // this will ask user to enter code
104+ console .log (' 2FA verification result (window):' , verificationResult );
105+ }
106+
107+ async function get2FaConfirmationResultTwoFactorsAuth() {
108+ const verificationResult = await twoFactorsAuth .get2FaConfirmationResult (); // this will ask user to enter code
109+ console .log (' 2FA verification result (twoFactorsAuth):' , verificationResult );
110+ }
92111 </script >
You can’t perform that action at this time.
0 commit comments