From 9de2ea22e3b25ab402317c83dd605d6c8a83f548 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Tue, 6 Nov 2018 17:55:09 +0000 Subject: [PATCH] Remove third-party password strength plugin --- resources/assets/js/password-strength.js | 80 ------------------- resources/views/dashboard/team/add.blade.php | 3 +- .../views/dashboard/user/index.blade.php | 3 +- webpack.mix.js | 1 - 4 files changed, 2 insertions(+), 85 deletions(-) delete mode 100644 resources/assets/js/password-strength.js diff --git a/resources/assets/js/password-strength.js b/resources/assets/js/password-strength.js deleted file mode 100644 index 1471b980..00000000 --- a/resources/assets/js/password-strength.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Combine jQuery and zxcvbn to create a password strength meter. - * Based on : strengthify https://github.com/kabum/strengthify - */ -(function($) { - $.fn.strengthify = function(paramOptions) { - var me = this, - defaults = { - zxcvbn: 'https://cdnjs.cloudflare.com/ajax/libs/zxcvbn/2.0.2/zxcvbn.min.js' - }, - options = $.extend(defaults, paramOptions); - - // Add elements to the DOM - $('.strengthify-wrapper') - .append('
') - .append('
') - .append('
') - .append('
') - .append('
'); - - $.ajax({ - cache: true, - dataType: 'script', - url: options.zxcvbn - }).done(function() { - me.bind('keyup input', function() { - var password = $(this).val(), - // Hide strengthigy if no input is provided - opacity = (password === '') ? 0 : 1, - // Calculate result - result = zxcvbn(password), - css = '', - // cache jQuery selections - $container = $('.strengthify-container'), - $wrapper = $('.strengthify-wrapper'); - - $wrapper.children().css( - 'opacity', - opacity - ).css( - '-ms-filter', - '"progid:DXImageTransform.Microsoft.Alpha(Opacity=' + opacity * 100 + ')"' - ); - - // Style strengthify bar - // possible scores: 0, 1, 2, 3, 4 - switch (result.score) { - case 0: - case 1: - css = 'password-bad'; - break; - case 2: - css = 'password-medium'; - break; - case 3: - case 4: - css = 'password-good'; - break; - } - - $container - .attr('class', css + ' strengthify-container') - // possible scores: 0, 1, 2, 3, 4 - .css( - 'width', - // if score is '0' it will be changed to '1' to - // not hide strengthify if the password is extremely weak - ((result.score === 0 ? 1 : result.score) * 25) + '%' - ); - - // Reset state for empty string password - if (password === '') { - $container.css('width', 0); - } - }); - }); - - return me; - }; -}(jQuery)); diff --git a/resources/views/dashboard/team/add.blade.php b/resources/views/dashboard/team/add.blade.php index 3c7c70cd..e613f1c9 100644 --- a/resources/views/dashboard/team/add.blade.php +++ b/resources/views/dashboard/team/add.blade.php @@ -26,8 +26,7 @@
- -
+
@if($currentUser->isAdmin)
diff --git a/resources/views/dashboard/user/index.blade.php b/resources/views/dashboard/user/index.blade.php index dcaabb30..dfd40f15 100644 --- a/resources/views/dashboard/user/index.blade.php +++ b/resources/views/dashboard/user/index.blade.php @@ -31,8 +31,7 @@
- -
+

diff --git a/webpack.mix.js b/webpack.mix.js index 3b5d1bc2..e32b8e0d 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -46,7 +46,6 @@ mix 'node_modules/sweetalert2/dist/sweetalert2.min.js', 'node_modules/livestamp/livestamp.js', 'node_modules/jquery-serializeobject/jquery.serializeObject.js', - 'resources/assets/js/password-strength.js', 'resources/assets/js/cachet.js', ], 'public/dist/js/all.js')