11$ ( function ( ) {
2- function tFaToast ( message , timer = 3000 ) {
3- Hm_Notices . show ( [ message ] ) ;
4- const tm = setTimeout ( function ( ) {
5- Hm_Notices . hide ( true ) ;
6- clearTimeout ( tm ) ;
7- } , timer ) ;
8- }
9-
102 function focusElement ( elem ) {
113 elem . focus ( ) ;
124 elem . select ( ) ;
@@ -79,7 +71,7 @@ $(function () {
7971
8072 if ( checked && ! verified ) {
8173 $ ( this ) . prop ( "checked" , false ) ;
82- tFaToast ( err_msg ( 'You need to verify your 2 factor authentication code before processing' ) ) ;
74+ Hm_Notices . show ( 'You need to verify your 2 factor authentication code before processing' , 'warning' ) ;
8375 return ;
8476 }
8577 } ) ;
@@ -138,11 +130,7 @@ $(function () {
138130 var code = getInputCode ( ) ;
139131
140132 if ( ! code ) {
141- tFaToast ( err_msg ( "You need to enter the verification code" ) ) ;
142- var tm = setTimeout ( function ( ) {
143- Hm_Notices . hide ( true ) ;
144- clearTimeout ( tm ) ;
145- } , 2000 ) ;
133+ Hm_Notices . show ( "You need to enter the verification code" , 'warning' ) ;
146134 return ;
147135 }
148136
@@ -157,13 +145,13 @@ $(function () {
157145 verified = true ;
158146 formInput . prop ( "checked" , true ) ;
159147 confirmationBtn . addClass ( "valid" ) ;
160- tFaToast ( "2 factor authentication enabled" ) ;
148+ Hm_Notices . show ( "2 factor authentication enabled" ) ;
161149 } else {
162150 verified = false ;
163151 formInput . prop ( "checked" , false ) ;
164152 $ ( ".tfa_confirmation_input_digit" ) . addClass ( "invalid" ) ;
165153 confirmationBtn . addClass ( "invalid" ) . addClass ( "shake" ) ;
166- tFaToast ( "ERR2 factor authentication code does not match") ;
154+ Hm_Notices . show ( "2 factor authentication code does not match", 'danger' ) ;
167155 }
168156 confirmationBtn . text ( "Verify code" ) . removeClass ( "loading" ) ;
169157 }
0 commit comments