113
113
<div class =" modal-content" ></div >
114
114
</div >
115
115
</div >
116
-
117
- @if ($up = $o -> getObject (' userpassword' ) )
118
- <!-- CHECK USERPASSWORD -->
119
- <div class =" modal fade" id =" userpassword_check-modal" tabindex =" -1" aria-labelledby =" userpassword_check-label" aria-hidden =" true" >
120
- <div class =" modal-dialog modal-lg modal-fullscreen-lg-down" >
121
- <div class =" modal-content" >
122
- <div class =" modal-header" >
123
- <h1 class =" modal-title fs-5" id =" userpassword_check-label" >Check Passwords for {{ $dn } } </h1 >
124
- <button type =" button" class =" btn-close" data-bs-dismiss =" modal" aria-label =" Close" ></button >
125
- </div >
126
-
127
- <div class =" modal-body" >
128
- <table class =" table table-bordered p-1" >
129
- @foreach ($up -> values as $key => $value )
130
- <tr >
131
- <th >Check</th >
132
- <td >{{ $up -> render_item_old ($key ) } } </td >
133
- <td >
134
- <input type =" password" style =" width : 90% " name =" password[{{ $key } } ]" > <i class =" fas fa-fw fa-lock" ></i >
135
- <div class =" invalid-feedback pb-2" >
136
- Invalid Password
137
- </div >
138
- </td >
139
- </tr >
140
- @endforeach
141
- </table >
142
- </div >
143
-
144
- <div class =" modal-footer" >
145
- <button type =" button" class =" btn btn-sm btn-secondary" data-bs-dismiss =" modal" >Close</button >
146
- <button type =" button" class =" btn btn-sm btn-primary" id =" userpassword_check-submit" ><i class =" fas fa-fw fa-spinner fa-spin d-none" ></i > Check</button >
147
- </div >
148
- </div >
149
- </div >
150
- </div >
151
- @endif
152
116
@endsection
153
117
154
118
@section (' page-scripts' )
@@ -254,7 +218,7 @@ function editmode() {
254
218
that = $ (' #entry_export' );
255
219
256
220
$ .ajax ({
257
- type : ' GET' ,
221
+ method : ' GET' ,
258
222
url: ' {{ url (' entry/export' ) } } /' + dn,
259
223
cache: false ,
260
224
beforeSend : function () {
@@ -276,68 +240,30 @@ function editmode() {
276
240
})
277
241
break ;
278
242
243
+ case ' entry-userpassword-check' :
244
+ $ .ajax ({
245
+ method: ' GET' ,
246
+ url: ' {{ url (' modal/userpassword-check' ) } } /' + dn,
247
+ dataType: ' html' ,
248
+ cache: false ,
249
+ beforeSend : function () {
250
+ that .empty ().append (' <span class="p-3"><i class="fas fa-3x fa-spinner fa-pulse"></i></span>' );
251
+ },
252
+ success : function (data ) {
253
+ that .empty ().html (data);
254
+ },
255
+ error : function (e ) {
256
+ if (e .status !== 412 )
257
+ alert (' That didnt work? Please try again....' );
258
+ },
259
+ })
260
+ break ;
261
+
279
262
default :
280
263
console .log (' No action for button:' + $ (item .relatedTarget ).attr (' id' ));
281
264
}
282
265
});
283
266
284
- @if ($up )
285
- $ (' button[id=userpassword_check-submit]' ).on (' click' ,function (item ) {
286
- var that = $ (this );
287
-
288
- var passwords = $ (' #userpassword_check-modal' )
289
- .find (' input[name^="password["' )
290
- .map ((key ,item )=> item .value );
291
-
292
- if (passwords .length === 0 ) return false ;
293
-
294
- $ .ajax ({
295
- type: ' POST' ,
296
- beforeSend : function () {
297
- // Disable submit, add spinning icon
298
- that .prop (' disabled' ,true );
299
- that .find (' i' ).removeClass (' d-none' );
300
- },
301
- complete : function () {
302
- that .prop (' disabled' ,false );
303
- that .find (' i' ).addClass (' d-none' );
304
- },
305
- success : function (data ) {
306
- data .forEach (function (item ,key ) {
307
- var i = $ (' #userpassword_check-modal' )
308
- .find (' input[name="password[' + key+ ' ]' )
309
- .siblings (' i' );
310
-
311
- var feedback = $ (' #userpassword_check-modal' )
312
- .find (' input[name="password[' + key+ ' ]' )
313
- .siblings (' div.invalid-feedback' );
314
-
315
- if (item === ' OK' ) {
316
- i .removeClass (' text-danger' ).addClass (' text-success' ).removeClass (' fa-lock' ).addClass (' fa-lock-open' );
317
- if (feedback .is (' :visible' ))
318
- feedback .hide ();
319
- } else {
320
- i .removeClass (' text-success' ).addClass (' text-danger' ).removeClass (' fa-lock-open' ).addClass (' fa-lock' );
321
- if (! feedback .is (' :visible' ))
322
- feedback .show ();
323
- }
324
- })
325
- },
326
- error : function (e ) {
327
- if (e .status !== 412 )
328
- alert (' That didnt work? Please try again....' );
329
- },
330
- url: ' {{ url (' entry/password/check' ) } }' ,
331
- data: {
332
- dn: dn,
333
- password: Array .from (passwords),
334
- },
335
- dataType: ' json' ,
336
- cache: false
337
- })
338
- });
339
- @endif
340
-
341
267
@if (old () )
342
268
editmode ();
343
269
@endif
0 commit comments