Remove third-party password strength plugin

This commit is contained in:
James Brooks 2018-11-06 17:55:09 +00:00
parent 75ac12631e
commit 9de2ea22e3
4 changed files with 2 additions and 85 deletions

View File

@ -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('<div class="strengthify-bg" />')
.append('<div class="strengthify-container" />')
.append('<div class="strengthify-separator" style="left: 25%" />')
.append('<div class="strengthify-separator" style="left: 50%" />')
.append('<div class="strengthify-separator" style="left: 75%" />');
$.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));

View File

@ -26,8 +26,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label>{{ trans('forms.user.password') }}</label> <label>{{ trans('forms.user.password') }}</label>
<input type="password" class="form-control password-strength" name="password" value="" placeholder="{{ trans('forms.user.password') }}"> <input type="password" class="form-control" name="password" value="" placeholder="{{ trans('forms.user.password') }}">
<div class="strengthify-wrapper"></div>
</div> </div>
@if($currentUser->isAdmin) @if($currentUser->isAdmin)
<div class="form-group"> <div class="form-group">

View File

@ -31,8 +31,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label>{{ trans('forms.user.password') }}</label> <label>{{ trans('forms.user.password') }}</label>
<input type="password" class="form-control password-strength" name="password" value="" placeholder="{{ trans('forms.user.password') }}"> <input type="password" class="form-control" name="password" value="" placeholder="{{ trans('forms.user.password') }}">
<div class="strengthify-wrapper"></div>
</div> </div>
<hr> <hr>
<div class="form-group"> <div class="form-group">

View File

@ -46,7 +46,6 @@ mix
'node_modules/sweetalert2/dist/sweetalert2.min.js', 'node_modules/sweetalert2/dist/sweetalert2.min.js',
'node_modules/livestamp/livestamp.js', 'node_modules/livestamp/livestamp.js',
'node_modules/jquery-serializeobject/jquery.serializeObject.js', 'node_modules/jquery-serializeobject/jquery.serializeObject.js',
'resources/assets/js/password-strength.js',
'resources/assets/js/cachet.js', 'resources/assets/js/cachet.js',
], 'public/dist/js/all.js') ], 'public/dist/js/all.js')