@@ -29,6 +29,7 @@ function genPotentialSecret() {
2929function CodeValidator ( props : {
3030 secret : string
3131} ) : React . ReactElement {
32+ const { t} = useTranslation ( ) ;
3233 const formSubmit = useCallback (
3334 ( code : string , onError : ( msg : string ) => void ) => {
3435 const formObject = new FormData ( ) ;
@@ -46,7 +47,12 @@ function CodeValidator(props: {
4647 return resp . json ( ) ;
4748 } ) . then ( ( json ) => {
4849 if ( json . ok == 'success' ) {
49- swal . fire ( 'Success!' , json . message , 'success' ) . then ( ( ) => {
50+ swal . fire ( {
51+ title : t ( 'Success!' , { ns : 'loris' } ) ,
52+ text : json . message ,
53+ type : 'success' ,
54+ confirmButtonText : t ( 'OK' , { ns : 'loris' } ) ,
55+ } ) . then ( ( ) => {
5056 window . location . href = loris . BaseURL + '/my_preferences/' ;
5157 } ) ;
5258 } else if ( json . error ) {
@@ -60,7 +66,7 @@ function CodeValidator(props: {
6066 } , [ props . secret ] ) ;
6167 return (
6268 < div >
63- < h3 > Validate Code</ h3 >
69+ < h3 > { t ( ' Validate Code' , { ns : 'my_preferences' } ) } </ h3 >
6470 < MFAPrompt validate = { formSubmit } />
6571 </ div >
6672 ) ;
@@ -92,13 +98,16 @@ function MFAIndex(): React.ReactElement {
9298 </ Modal >
9399 < p > { t ( 'Scan the following QR code below in your MFA authenticator and enter the code to validate.' , { ns : 'my_preferences' } ) } </ p >
94100 < p >
95- < b > Note that this will < i > overwrite</ i > any previously
96- setup MFA in LORIS!</ b >
101+ < strong > < Trans
102+ ns = "my_preferences"
103+ components = { [ < strong > overwrite</ strong > ] }
104+ defaults = "Note that this will <0>overwrite</0> any previously setup MFA in LORIS!" /> </ strong >
97105 </ p >
98106 < QRCode value = { mfaUrl } />
99- < p > Can't scan the QR code? < a href = "#" onClick = { ( ) => setShowModal ( true ) } >
100- Setup manually.</ a >
101- </ p >
107+ < p > < Trans
108+ ns = "my_preferences"
109+ defaults = "Can't scan the QR code? <0>Setup manually.</0>"
110+ components = { [ < a href = "#" onClick = { ( ) => setShowModal ( true ) } /> ] } /> </ p >
102111 < CodeValidator secret = { key } />
103112 </ div > ;
104113}
0 commit comments