{"id":17181514,"url":"https://github.com/dimitarchristoff/strongpass","last_synced_at":"2025-04-13T17:44:51.724Z","repository":{"id":3098282,"uuid":"4123507","full_name":"DimitarChristoff/StrongPass","owner":"DimitarChristoff","description":"Password Strength Checker for mootools","archived":false,"fork":false,"pushed_at":"2015-08-14T17:44:55.000Z","size":345,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T03:09:45.309Z","etag":null,"topics":["javascript","mootools","password-strength"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DimitarChristoff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-24T10:29:27.000Z","updated_at":"2024-12-26T05:55:31.000Z","dependencies_parsed_at":"2022-08-30T20:01:06.191Z","dependency_job_id":null,"html_url":"https://github.com/DimitarChristoff/StrongPass","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DimitarChristoff%2FStrongPass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DimitarChristoff%2FStrongPass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DimitarChristoff%2FStrongPass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DimitarChristoff%2FStrongPass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DimitarChristoff","download_url":"https://codeload.github.com/DimitarChristoff/StrongPass/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248757034,"owners_count":21156867,"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":["javascript","mootools","password-strength"],"created_at":"2024-10-15T00:34:32.961Z","updated_at":"2025-04-13T17:44:51.706Z","avatar_url":"https://github.com/DimitarChristoff.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"StrongPass.js\n==============\n\nA basic plugin that can do `scoring` of password strength as a user types within an input field.\n\n![Screenshot](https://github.com/DimitarChristoff/StrongPass/raw/master/StrongPass.png)\n\nSee it live in action on this jsfiddle [here](http://jsfiddle.net/dimitar/n8Dza/) or [this one](http://jsfiddle.net/dimitar/nZn6A/).\n\n[![endorse](http://api.coderwall.com/dimitarchristoff/endorsecount.png)](http://coderwall.com/dimitarchristoff) [![Build Status](https://secure.travis-ci.org/DimitarChristoff/StrongPass.png?branch=master)](http://travis-ci.org/DimitarChristoff/StrongPass)\n\nHow to use\n----------\n\nGet MooTools (1.4.5+, ideally 1.5.1). No mootools-more required. Have a password field and some CSS.\n\n```html\n\n\t\u003cinput type=\"password\" id=\"foo\" /\u003e\n```\n\n```css\n\n\tdiv.pass-container {\n\t\theight: 30px;\n\t}\n\n\tdiv.pass-bar {\n\t\theight: 11px;\n\t\tmargin-top: 2px;\n\t}\n\tdiv.pass-hint {\n\t\tfont-family: arial;\n\t\tfont-size: 11px;\n\t}\n```\n\nCreate your instance\n\n```javascript\n\n\tnew StrongPass(\"foo\", {\n\t\tonReady: function() {\n\t\t\tconsole.log('you can begin typing');\n\t\t},\n\t\tonPass: function(score, verdict) {\n\t\t\tconsole.log('pass', score, verdict)\n\t\t},\n\t\tonFail: function(score, verdict) {\n\t\t\tconsole.log('fail', score, verdict);\n\t\t},\n\t\tonBanned: function(word) {\n\t\t\tconsole.warn(word, 'is not allowed as it is on the bannedPasswords list');\n\t\t}\n\t});\n```\n\nAlternatively, you can just use it as a tool to check and feed back scores without output - so you can script your own via the events instead.\n\n```javascript\n\n\tvar indicator = document.getElement('span.pwStrengthResult'),\n\t\tcolourIndicate = function(level, label) {\n\t\t\tindicator.set({\n\t\t\t\thtml: label,\n\t\t\t\tstyles: {\n\t\t\t\t\tcolor: this.options.colors[level] || this.options.colors.getLast()\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\tnew StrongPass('foo', {\n\t\tbannedPass: 'Very weak (too common)',\n\t\tverdicts: [\n\t\t\t'Too Short',\n\t\t\t'Weak',\n\t\t\t'Good',\n\t\t\t'Strong'\n\t\t],\n\t\tcolors: [\n\t\t\t'#777',\n\t\t\t'#900',\n\t\t\t'#070',\n\t\t\t'#0c0'\n\t\t],\n\t\t// tweak scores here\n\t\tscores: [\n\t\t\t10,\n\t\t\t30,\n\t\t\t40,\n\t\t\t100\n\t\t],\n\t\trender: false,\n\t\tonPass: function() {\n\t\t\tcolourIndicate.apply(this, arguments);\n\t\t},\n\t\tonFail: function() {\n\t\t\tcolourIndicate.apply(this, arguments);\n\t\t}\n\t});\n```\n\nHow it works\n------------\n\nA series of tests and definitions dictate the total `scoring` of the string in the input (or an arbitrary string) as a password. Certain logic is applied to do with best practices that helps in the scoring. In terms of configuration of how lax the plugin is, you can use several things.\n\n- `options` - can set `scores` as ranges that map to verdicts. In the example above, anything scoring below 10 will be deemed `Too short`, between 10 and 30 - `Weak` and so forth. By upping these values, you can make it more demanding - or less demanding, dependent on what your users are like.\n- `length` - there are some extra bonuses added for each extra character over the minimum length as the longer a password is, the more time it will take to brute force. The values added here are somewhat arbitrary but you can edit the `checkPassword` method and set your own values.\n- `regex scoring` - the class has a static array of simple objects that looks like this:\n\n```javascript\n\n\tchecks: [\n\t\t/* alphaLower */ {\n\t\t\tre: /[a-z]/,\n\t\t\tscore: 1\n\t\t},\n\t\t/* alphaUpper */ {\n\t\t\tre: /[A-Z]/,\n\t\t\tscore: 5\n\t\t},\n\t\t/* mixture of upper and lowercase */ {\n\t\t\tre: /([a-z].*[A-Z])|([A-Z].*[a-z])/,\n\t\t\tscore: 2\n\t\t},\n\t\t/* threeNumbers */ {\n\t\t\tre: /(.*[0-9].*[0-9].*[0-9])/,\n\t\t\tscore: 7\n\t\t},\n\t\t/* special chars */ {\n\t\t\tre: /.[!@#$%^\u0026*?_~]/,\n\t\t\tscore: 5\n\t\t},\n\t\t/* multiple special chars */ {\n\t\t\tre: /(.*[!@#$%^\u0026*?_~].*[!@#$%^\u0026*?_~])/,\n\t\t\tscore: 7\n\t\t},\n\t\t/* all together now, does it look nice? */ {\n\t\t\tre: /([a-zA-Z0-9].*[!@#$%^\u0026*?_~])|([!@#$%^\u0026*?_~].*[a-zA-Z0-9])/,\n\t\t\tscore: 3\n\t\t},\n\t\t/* password of a single repeated char sucks */ {\n\t\t\tre: /(.)\\1+$/,\n\t\t\tscore: 2\n\t\t}\n\t],\n```\n\nYou can add / push to this array to add further changes or you can edit the regex or the scoring applied. A score can also be negative. For instance, we add `2` bonus points if the password has more than 1 letter so it's not just something like `aaaaaa` to make it pass. This is a 'positive' score that awards variety but you can easily reverse the check and the result of the regex to a penalising one by doing:\n\n\t/* password of a single char sucks A LOT */ {\n\t\tre: /^(.)\\1+$/,\n\t\tscore: -20\n\t}\n\n\nTests\n-----\n\nVia Buster.js, go to `test/index.html` to run.\n\nYou can also test via node and Grunt. To install buster:\n\n\t$ npm install -g buster phantomjs\n\nTo install locally:\n\n\t$ npm install\n\nTo test, either of these works (via PhantomJS):\n\n\t$ npm test\n\t$ grunt\n\nTo start in capture mode for multiple browsers:\n\n\t$ buster-server \u0026\n\nOnce you have captured your target browsers, just run:\n\n\t$ open http://localhost:1111/capture\n\t$ buster-test -r specification\n\nUsing under AMD\n---------------\n\nYou can now just use RequireJS or Almond or similar to load the Class:\n\n```javascript\n\trequire(['js/StrongPass'], function(StrongPass){\n\t\tnew StrongPass({});\n\t});\n\n\t// or mixin / extend and do your own\n\tdefine(['js/StrongPass'], function(StrongPass){\n\t\treturn new Class({\n\t\t\tExtends: StrongPass,\n\t\t});\n\t});\n```\n\nIf an AMD compatible `define` is found, it will be preferred to global object.\n\nLicense\n-------\n\nLicensed under the MIT License. You are not allowed to [use for evil](http://www.youtube.com/watch?v=-hCimLnIsDA)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimitarchristoff%2Fstrongpass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimitarchristoff%2Fstrongpass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimitarchristoff%2Fstrongpass/lists"}