@@ -2,11 +2,13 @@ import utils from "./utils";
22
33$ ( document ) . ready ( function ( ) {
44 $ ( 'body' ) . on ( 'click' , '.password-field .bi-eye-slash' , function ( ) {
5- var i = $ ( this ) . closest ( '.password-field' ) . find ( 'input[type!=hidden]' ) ;
6- if ( i . attr ( 'type' ) == 'password' )
5+ let i = $ ( this ) . closest ( '.password-field' ) . find ( 'input[type!=hidden]' ) ;
6+ if ( i . attr ( 'type' ) == 'password' ) {
77 i . attr ( 'type' , 'text' ) ;
8- else
8+ }
9+ else {
910 i . attr ( 'type' , 'password' ) ;
11+ }
1012
1113 $ ( this ) . toggleClass ( 'bi-eye' ) . toggleClass ( 'bi-eye-close' ) ;
1214 } ) ;
@@ -19,10 +21,10 @@ $(document).ready(function() {
1921 appendTo = '#' + modal . attr ( 'id' ) ;
2022 }
2123
22- var input = $ ( this ) ;
24+ let input = $ ( this ) ;
2325 input . popover ( {
2426 content : function ( ) {
25- var ret = `<div>
27+ let ret = `<div>
2628 <div class="row mb-2"><label for="password" class="col-4 col-form-label">${ _ ( 'texts.auth.password' ) } </label><div class="col-8"><input type="password" class="form-control" name="password" value="" autocomplete="off" minlength="8"></div></div>
2729 <div class="row mb-2"><label for="password_confirm" class="col-4 col-form-label">${ _ ( 'texts.auth.confirm_password' ) } </label><div class="col-8"><input type="password" class="form-control" name="password_confirm" value="" autocomplete="off" minlength="8"></div></div>` ;
2830
@@ -37,12 +39,12 @@ $(document).ready(function() {
3739 ret . find ( 'button.btn-success' ) . click ( function ( e ) {
3840 e . preventDefault ( ) ;
3941 e . stopPropagation ( ) ;
40- var password = ret . find ( 'input[name=password]' ) . val ( ) ;
41- var confirm = ret . find ( 'input[name=password_confirm]' ) . val ( ) ;
42+ let password = ret . find ( 'input[name=password]' ) . val ( ) ;
43+ let confirm = ret . find ( 'input[name=password_confirm]' ) . val ( ) ;
4244
4345 if ( password == confirm ) {
4446 if ( ret . find ( 'input[name=enforce_change]' ) . length != 0 ) {
45- var enforce = ret . find ( 'input[name=enforce_change]' ) . prop ( 'checked' ) ? 'true' : 'false' ;
47+ let enforce = ret . find ( 'input[name=enforce_change]' ) . prop ( 'checked' ) ? 'true' : 'false' ;
4648 input . closest ( '.input-group' ) . find ( 'input[name=enforce_password_change]' ) . val ( enforce ) ;
4749 }
4850
@@ -77,7 +79,7 @@ $(document).ready(function() {
7779
7880 $ ( 'body' ) . on ( 'submit' , '#password-protection-dialog form' , function ( event ) {
7981 event . preventDefault ( ) ;
80- var modal = $ ( this ) . closest ( '.modal' ) ;
82+ let modal = $ ( this ) . closest ( '.modal' ) ;
8183
8284 $ . ajax ( {
8385 method : 'POST' ,
@@ -87,15 +89,15 @@ $(document).ready(function() {
8789 } ,
8890 success : function ( data ) {
8991 modal . modal ( 'hide' ) ;
90- var target = modal . attr ( 'data-form-target' ) ;
91- var form = $ ( target ) ;
92+ let target = modal . attr ( 'data-form-target' ) ;
93+ let form = $ ( target ) ;
9294
9395 if ( data == 'ok' ) {
9496 form . attr ( 'data-password-protected-verified' , '1' ) ;
9597 form . submit ( ) ;
9698 }
9799 else {
98- var save_button = form . find ( 'button:submit' ) ;
100+ let save_button = utils . j ( ) . submitButton ( form ) ;
99101 utils . inlineFeedback ( save_button , _ ( 'texts.auth.wrong' ) ) ;
100102 }
101103 }
0 commit comments