From d78452649da2cd59df594a2a5c210cb7045ac899 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Mon, 3 Aug 2020 12:12:17 +0200 Subject: [PATCH] 0.5.9 Signed-off-by: Morris Jobke --- LICENSE | 2 +- README.md | 6 ++++++ bower.json | 2 +- jquery.strengthify.js | 4 ++-- jquery.strengthify.min.js | 2 +- package.json | 2 +- strengthify.css | 4 ++-- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/LICENSE b/LICENSE index d3cdf75..9465d9f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2013-2016 Morris Jobke +Copyright (c) 2013-2020 Morris Jobke Eve Ragins @ Eve Corp (github.com/eve-corp) Permission is hereby granted, free of charge, to any person obtaining a copy of diff --git a/README.md b/README.md index 6a2573a..290da3e 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,12 @@ Versions --------
+
0.5.9
+
+
    +
  • Don't overdo the strength check, the first 100 chars are enough (https://github.com/morrisjobke/strengthify/pull/32)
  • +
+
0.5.8
    diff --git a/bower.json b/bower.json index dc515e5..086ab11 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "strengthify", - "version": "0.5.8", + "version": "0.5.9", "homepage": "https://github.com/MorrisJobke/strengthify", "authors": [ "Eve Ragins + * Copyright (c) 2013-2020 Morris Jobke * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in diff --git a/jquery.strengthify.min.js b/jquery.strengthify.min.js index be8dd73..dfa08e7 100644 --- a/jquery.strengthify.min.js +++ b/jquery.strengthify.min.js @@ -1 +1 @@ -!function(t){t.fn.strengthify=function(e){"use strict";var s={zxcvbn:"zxcvbn/zxcvbn.js",userInputs:[],titles:["Weakest","Weak","So-so","Good","Perfect"],tilesOptions:{tooltip:!0,element:!1},drawTitles:!1,drawMessage:!1,drawBars:!0,$addAfter:null,nonce:null};return this.each(function(){var a=t.extend(s,e);function r(e){return t('div[data-strengthifyFor="'+e+'"]')}a.drawTitles||a.drawMessage||a.drawBars||console.warn("expect at least one of 'drawTitles', 'drawMessage', or 'drawBars' to be true"),function(){var e=t(this),s=e.attr("id"),i=function(){var e=t(this).val(),s=t(this).attr("id"),i=""===e?0:1,n=zxcvbn(e,a.userInputs),o="",d="",c="",l=r(s),p=l.find(".strengthify-container"),f=l.find("[data-strengthifyMessage]");switch(l.children().css("opacity",i).css("-ms-filter",'"progid:DXImageTransform.Microsoft.Alpha(Opacity='+100*i+')"'),a.onResult&&a.onResult(n),n.score){case 0:case 1:o="password-bad",d="danger",c=n.feedback?n.feedback.suggestions.join("
    "):"";break;case 2:d="warning",c=n.feedback?n.feedback.suggestions.join("
    "):"",o="password-medium";break;case 3:o="password-good",d="info",c="Getting better.";break;case 4:o="password-good",d="success",c="Looks good."}f&&(f.removeAttr("class"),f.addClass("bg-"+d),""===e&&(c=""),f.html(c)),p&&(p.attr("class",o+" strengthify-container").css("width",25*(0===n.score?1:n.score)+"%"),""===e&&p.css("width",0)),a.drawTitles&&(a.tilesOptions.tooltip&&(l.attr("title",a.titles[n.score]).tooltip({placement:"bottom",trigger:"manual"}).tooltip("fixTitle").tooltip("show"),0===i&&l.tooltip("hide")),a.tilesOptions.element&&l.find(".strengthify-tiles").text(a.titles[n.score]))}.bind(this),n=a.$addAfter;n||(n=e),n.after('
    '),a.drawBars&&r(s).append('
    ').append('
    ').append('
    ').append('
    ').append('
    '),a.drawMessage&&r(s).append("
    "),a.drawTitles&&a.tilesOptions&&r(s).append('
    ');var o=document.createElement("script");o.src=a.zxcvbn,null!==a.nonce&&o.setAttribute("nonce",a.nonce),o.onload=function(){e.parent().on("scroll",i),e.bind("keyup input change",i)},document.head.appendChild(o)}.call(this)})}}(jQuery); \ No newline at end of file +(function($){$.fn.strengthify=function(paramOptions){"use strict";var defaults={zxcvbn:'zxcvbn/zxcvbn.js',userInputs:[],titles:['Weakest','Weak','So-so','Good','Perfect'],tilesOptions:{tooltip:true,element:false},drawTitles:false,drawMessage:false,drawBars:true,$addAfter:null,nonce:null};return this.each(function(){var options=$.extend(defaults,paramOptions);if(!options.drawTitles&&!options.drawMessage&&!options.drawBars){console.warn("expect at least one of 'drawTitles', 'drawMessage', or 'drawBars' to be true")}function getWrapperFor(id){return $('div[data-strengthifyFor="'+id+'"]')};function drawStrengthify(){var password=$(this).val().substring(0,100),elemId=$(this).attr('id'),opacity=(password==='')?0:1,result=zxcvbn(password,options.userInputs),css='',bsLevel='',message='',$wrapper=getWrapperFor(elemId),$container=$wrapper.find('.strengthify-container'),$message=$wrapper.find('[data-strengthifyMessage]');$wrapper.children().css('opacity',opacity).css('-ms-filter','"progid:DXImageTransform.Microsoft.Alpha(Opacity='+opacity*100+')"');if(options.onResult){options.onResult(result)}switch(result.score){case 0:case 1:css='password-bad';bsLevel='danger';message=result.feedback?result.feedback.suggestions.join('
    '):"";break;case 2:bsLevel='warning';message=result.feedback?result.feedback.suggestions.join('
    '):"";css='password-medium';break;case 3:css='password-good';bsLevel='info';message="Getting better.";break;case 4:css='password-good';bsLevel='success';message="Looks good.";break}if($message){$message.removeAttr('class');$message.addClass('bg-'+bsLevel);if(password===''){message=''}$message.html(message)}if($container){$container.attr('class',css+' strengthify-container').css('width',((result.score===0?1:result.score)*25)+'%');if(password===''){$container.css('width',0)}}if(options.drawTitles){if(options.tilesOptions.tooltip){$wrapper.attr('title',options.titles[result.score]).tooltip({placement:'bottom',trigger:'manual'}).tooltip('fixTitle').tooltip('show');if(opacity===0){$wrapper.tooltip('hide')}}if(options.tilesOptions.element){$wrapper.find(".strengthify-tiles").text(options.titles[result.score])}}};function init(){var $elem=$(this),elemId=$elem.attr('id');var drawSelf=drawStrengthify.bind(this);var $addAfter=options.$addAfter;if(!$addAfter){$addAfter=$elem}$addAfter.after('
    ');if(options.drawBars){getWrapperFor(elemId).append('
    ').append('
    ').append('
    ').append('
    ').append('
    ')}if(options.drawMessage){getWrapperFor(elemId).append('
    ')}if(options.drawTitles&&options.tilesOptions){getWrapperFor(elemId).append('
    ')}var script=document.createElement("script");script.src=options.zxcvbn;if(options.nonce!==null){script.setAttribute('nonce',options.nonce)}script.onload=function(){$elem.parent().on('scroll',drawSelf);$elem.bind('keyup input change',drawSelf)};document.head.appendChild(script)};init.call(this);})}}(jQuery)); \ No newline at end of file diff --git a/package.json b/package.json index 5f9a3d2..f71f295 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "strengthify", - "version": "0.5.8", + "version": "0.5.9", "description": "Combine jQuery and zxcvbn to create a password strength meter", "main": "jquery.strengthify.js", "scripts": { diff --git a/strengthify.css b/strengthify.css index 836b9b4..a4b6bc6 100644 --- a/strengthify.css +++ b/strengthify.css @@ -1,9 +1,9 @@ /** * Strengthify - show the weakness of a password (uses zxcvbn for this) * https://github.com/MorrisJobke/strengthify - * Version: 0.5.8 + * Version: 0.5.9 * License: The MIT License (MIT) - * Copyright (c) 2013-2019 Morris Jobke + * Copyright (c) 2013-2020 Morris Jobke */ .strengthify-wrapper {