{"id":14972208,"url":"https://github.com/ablanco/jquery.pwstrength.bootstrap","last_synced_at":"2025-10-01T20:32:11.707Z","repository":{"id":6159933,"uuid":"7389507","full_name":"ablanco/jquery.pwstrength.bootstrap","owner":"ablanco","description":"jQuery Password Strength Meter for Twitter Bootstrap","archived":false,"fork":true,"pushed_at":"2024-08-15T09:13:53.000Z","size":2338,"stargazers_count":376,"open_issues_count":1,"forks_count":188,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-01-15T07:16:34.158Z","etag":null,"topics":["bootstrap","bootstrap2","bootstrap3","bootstrap4","jquery","jquery-plugin","password-strength"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"tanepiper/jquery.ui.pwstrength","license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ablanco.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"MIT-LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-12-31T17:40:24.000Z","updated_at":"2024-08-15T09:13:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ablanco/jquery.pwstrength.bootstrap","commit_stats":null,"previous_names":[],"tags_count":61,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ablanco%2Fjquery.pwstrength.bootstrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ablanco%2Fjquery.pwstrength.bootstrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ablanco%2Fjquery.pwstrength.bootstrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ablanco%2Fjquery.pwstrength.bootstrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ablanco","download_url":"https://codeload.github.com/ablanco/jquery.pwstrength.bootstrap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234897368,"owners_count":18903646,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bootstrap","bootstrap2","bootstrap3","bootstrap4","jquery","jquery-plugin","password-strength"],"created_at":"2024-09-24T13:46:33.424Z","updated_at":"2025-10-01T20:32:06.327Z","avatar_url":"https://github.com/ablanco.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jQuery Password Strength Meter for Twitter Bootstrap\n\n[![Code Climate](https://codeclimate.com/github/ablanco/jquery.pwstrength.bootstrap.png)](https://codeclimate.com/github/ablanco/jquery.pwstrength.bootstrap)\n[![JSDeliver](https://data.jsdelivr.com/v1/package/npm/pwstrength-bootstrap/badge?style=rounded)](https://www.jsdelivr.com/package/npm/pwstrength-bootstrap)\n\nThe jQuery Password Strength Meter is a plugin for Twitter Bootstrap that\nprovides rulesets for visualy displaying the quality of a users typed in\npassword.\n\nDual licensed under the MIT and GPL licenses. You can choose the one that\nsuits your purposes better.\n\n[npm entry](https://www.npmjs.com/package/pwstrength-bootstrap)\n\n## Looking for a Premium UI Kit?\n\nAdminKit is a developer friendly \u0026 highly customizable Bootstrap 5 admin template featuring hundreds of UI components, forms, tables, charts and icons. [Learn more](https://gumroad.com/a/706106483).\n\n[![AdminKit - Premium Bootstrap 5 admin template](https://assets.adminkit.io/banners/partners/adminkit-1200x628.jpg)](https://gumroad.com/a/706106483)\n\n## Requirements\n\n-   jQuery 1.7 or higher\n-   Bootstrap 2, 3, 4 or 5\n\n### Not using Bootstrap?\n\nThis plugin currently relies heavily on Bootstrap and it is not possible to\nuse it with another framework without making big changes in the code or\nforgetting completely about the UI feedback.\n\nForks to use it with another frameworks that I know of:\n\n-   [Zurb Foundation fork by edtownend](https://github.com/edtownend/jquery.pwstrength.foundation)\n\n## How to use it\n\nGet the latest version through [Bower](http://bower.io/search/?q=pwstrength-bootstrap),\n[npm](https://www.npmjs.com/package/pwstrength-bootstrap), or just download it\nfrom this [repository](https://github.com/ablanco/jquery.pwstrength.bootstrap/tree/master/dist).\nLoad it into your HTML after your original bootstrap and jQuery javascript files:\n\n```html\n\u003cscript type=\"text/javascript\" src=\"dist/pwstrength-bootstrap.min.js\"\u003e\u003c/script\u003e\n```\n\nThen just invoke the plugin on the password fields you want to attach a strength\nmeter to. For example, to use it on all the password fields with the default\nexamples:\n\n```javascript\n$(\":password\").pwstrength();\n```\n\nTo apply it only to one input and change the options:\n\n```javascript\n$(\"#passwd1\").pwstrength({\n    ui: { showVerdictsInsideProgressBar: true },\n});\n```\n\n## Options\n\nClick here to find [the complete list of options for the plugin](OPTIONS.md).\n\nIf you are looking for options to change or add new texts, please have a look\nat the internationalization section.\n\n## Methods\n\nOnce the plugin has been initialized, it is possible to interact with it\nthrough the methods.\n\n### Force an update\n\nIt is possible to force an update on a password strength meter. It will force\na new score calculation and an update of the UI elements, the `onKeyUp`\ncallback will be called.\n\n```javascript\n$(\"#passwdfield\").pwstrength(\"forceUpdate\");\n```\n\n### Remove the strength meter\n\nThis will remove the data associated to the meter, and the UI elements.\n\n```javascript\n$(\"#passwdfield\").pwstrength(\"destroy\");\n```\n\n### Adding Custom Rules\n\nThe plugin comes with the functionality to easily define your own custom rules.\nThe format is as follows:\n\n```javascript\n$(\"#passwdfield\").pwstrength(\n    \"addRule\",\n    \"ruleName\",\n    function (options, word, score) {},\n    rule_score,\n    rule_enabled\n);\n```\n\nExample:\n\n```javascript\n$(\"#passwdfield\").pwstrength(\n    \"addRule\",\n    \"testRule\",\n    function (options, word, score) {\n        return word.match(/[a-z].[0-9]/) \u0026\u0026 score;\n    },\n    10,\n    true\n);\n```\n\n### Change the score associated to a rule\n\nIt is possible to change the score given by a rule. It works like this:\n\n```javascript\n$(\"#passwdfield\").pwstrength(\"changeScore\", \"wordSequences\", -100);\n```\n\nThat would penalize even more the presence of sequences in the password.\n\n### Activate and deactivate rules\n\nIt is also possible to activate or deactivate rules. It as simple as:\n\n```javascript\n$(\"#passwdfield\").pwstrength(\"ruleActive\", \"wordSequences\", false);\n```\n\nThat would avoid looking for sequences in the password being tested.\n\n### Know if all password inputs pass a specific rule\n\nThis method allows to make a quick check to test if all password inputs in the\npage pass a rule, the method returns a boolean value. Example:\n\n```javascript\n$(\"#passwdfield\").pwstrength(\"ruleIsMet\", \"wordSequences\");\n```\n\n## Callback Functions\n\nThe plugin provides three callback functions, onLoad, onKeyUp, and scoreCalculated. You can use\nthem like this:\n\n```javascript\n$(document).ready(function () {\n    var options = {};\n    options.common = {\n        onLoad: function () {\n            $(\"#messages\").text(\"Start typing password\");\n        },\n        onKeyUp: function (evt, data) {\n            $(\"#length-help-text\").text(\n                \"Current length: \" +\n                    $(evt.target).val().length +\n                    \" and score: \" +\n                    data.score\n            );\n        },\n        onScore: function (options, word, totalScoreCalculated) {\n            // If my word meets a specific scenario, I want the min score to\n            // be the level 1 score, for example.\n            if (\n                word.length === 20 \u0026\u0026\n                totalScoreCalculated \u003c options.ui.scores[1]\n            ) {\n                // Score doesn't meet the score[1]. So we will return the min\n                // numbers of points to get that score instead.\n                return options.ui.score[1];\n            }\n            // Fall back to the score that was calculated by the rules engine.\n            // Must pass back the score to set the total score variable.\n            return totalScoreCalculated;\n        },\n    };\n    $(\":password\").pwstrength(options);\n});\n```\n\n## Extra restrictions\n\nThe plugin comes with two validation rules deactivated by default. One checks\nthe length of the password and penalizes it if it's too long; and the other\nchecks if the password contains a banned char, and penalizes it if it does.\n\nYou can configure the max length of the password by using the option `maxChar`.\nYou can also configure the invalid chars by using the option\n`invalidCharsRegExp`.\n\nIf you need these restrictions you just need to activate this two rules:\n\n```javascript\n$(document).ready(function () {\n    var options = {};\n    options.rules = {\n        activated: {\n            wordMaxLength: true,\n            wordInvalidChar: true,\n        },\n    };\n    $(\":password\").pwstrength(options);\n});\n```\n\n## Internationalization (i18n)\n\nThe plugin has support for internationalization. It also comes with some\nexample translations, you can find them in the [locales folder](locales).\n\nThe plugin provides a default implementation of the translation function, but\nyou can override it using the option `i18n.t`.\n\nThe default implementation will try to make use of the popular\n[i18next front-end translation tool](http://i18next.com/). If you happen to\nuse it, then you only need to add the translations into your resources and\nload them. The plugin will automatically make use of it. You can find more\ndetails about and how to use it i18next in their website. There is also an\nexample in the repository that uses that library.\n\nIn case the i18next library is not available, then the default behavior is\nto return the english texts as a fallback.\n\n### What are the translatable texts?\n\nYou can find the non-rules texts in any of the\n[provided translation example files](locales), and besides what you find there,\nevery rule name is a valid key for the translation file. **You can use this to\nadd new error messages (or remove them) for the engine rules**.\n\n### How to customize the translation function\n\nIf you want to manage translations yourself or you don't use i18next you can\noverride the default translation function like this:\n\n```javascript\n$(document).ready(function () {\n    var options = {};\n    options.i18n = {\n        t: function (key) {\n            var result = translateThisThing(key); // Do your magic here\n\n            return result === key ? \"\" : result; // This assumes you return the\n            // key if no translation was found, adapt as necessary\n        },\n    };\n    $(\":password\").pwstrength(options);\n});\n```\n\nYou can find an example of some keys and translations in the\n[locales folder](locales).\n\n## Examples\n\nThere are some examples in the `examples` directory. Just serve them with any\nwebserver and check them in your browser. Make sure you serve the `examples`\ndirectory as the site root. For example:\n\n```bash\ncd examples\npython -m SimpleHTTPServer\n```\n\nAnd go to [localhost:8000](http://localhost:8000).\n\nAlternatively, you can check-out the examples in a [hosted demo](https://cdn.rawgit.com/ablanco/jquery.pwstrength.bootstrap/master/examples/index.html).\n\n## Build and Test\n\nThe build and testing processes rely on [Grunt](http://gruntjs.com/). To use\nthem you need to have [node.js](http://nodejs.org/) and grunt-cli installed on\nyour system. Assuming you have node.js in your Linux system, you'll need to do\nsomething like this:\n\n```bash\nsudo npm install -g grunt-cli\n```\n\nNow you have the grunt command line utility installed globally.\n\n### Bundle and minified\n\nTo generate the bundle and the minified file you only need to execute this in\nthe project directory:\n\n```bash\nnpm install -d\ngrunt\n```\n\nIt will check the source files, and build a minified version with its\ncorresponding source map. The generated files will be available in the `dist`\ndirectory.\n\n### Testing\n\nTo run the tests the only thing you need to do is execute this in the project\ndirectory:\n\n```bash\nnpm install -d\ngrunt test\n```\n\nIt will check all the source files with [ESLint](https://eslint.org/) and run the\ntests, which are written with [Jasmine](http://jasmine.github.io/). You'll find\nthe tests source code in the `spec` directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fablanco%2Fjquery.pwstrength.bootstrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fablanco%2Fjquery.pwstrength.bootstrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fablanco%2Fjquery.pwstrength.bootstrap/lists"}