]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/user-profile.js
WordPress 4.2.4
[autoinstalls/wordpress.git] / wp-admin / js / user-profile.js
index b107d9877962e2b833610f625bb6d4af881cb503..72a2465c56f0d6683435485f5de9637b63a95ff7 100644 (file)
@@ -34,8 +34,8 @@
                var $colorpicker, $stylesheet, user_id, current_user_id,
                        select = $( '#display_name' );
 
-               $('#pass1').val('').keyup( check_pass_strength );
-               $('#pass2').val('').keyup( check_pass_strength );
+               $('#pass1').val('').on( 'input propertychange', check_pass_strength );
+               $('#pass2').val('').on( 'input propertychange', check_pass_strength );
                $('#pass-strength-result').show();
                $('.color-palette').click( function() {
                        $(this).siblings('input[name="admin_color"]').prop('checked', true);
                                        action:       'save-user-color-scheme',
                                        color_scheme: $this.children( 'input[name="admin_color"]' ).val(),
                                        nonce:        $('#color-nonce').val()
+                               }).done( function( response ) {
+                                       if ( response.success ) {
+                                               $( 'body' ).removeClass( response.data.previousScheme ).addClass( response.data.currentScheme );
+                                       }
                                });
                        }
                });
        });
 
+       $( '#destroy-sessions' ).on( 'click', function( e ) {
+               var $this = $(this);
+
+               wp.ajax.post( 'destroy-sessions', {
+                       nonce: $( '#_wpnonce' ).val(),
+                       user_id: $( '#user_id' ).val()
+               }).done( function( response ) {
+                       $this.prop( 'disabled', true );
+                       $this.siblings( '.notice' ).remove();
+                       $this.before( '<div class="notice notice-success inline"><p>' + response.message + '</p></div>' );
+               }).fail( function( response ) {
+                       $this.siblings( '.notice' ).remove();
+                       $this.before( '<div class="notice notice-error inline"><p>' + response.message + '</p></div>' );
+               });
+
+               e.preventDefault();
+       });
+
 })(jQuery);