https://github.com/edgeworkscreative/pwned-password
:lock: :boom: Web component built to prevent the use of passwords found in previous data breaches via Have I Been Pwned API
https://github.com/edgeworkscreative/pwned-password
haveibeenpwned pwned-passwords stencil stenciljs web-component
Last synced: 4 months ago
JSON representation
:lock: :boom: Web component built to prevent the use of passwords found in previous data breaches via Have I Been Pwned API
- Host: GitHub
- URL: https://github.com/edgeworkscreative/pwned-password
- Owner: edgeworkscreative
- License: mit
- Created: 2018-06-03T00:57:42.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-12T10:10:34.000Z (almost 7 years ago)
- Last Synced: 2025-03-06T13:07:40.525Z (4 months ago)
- Topics: haveibeenpwned, pwned-passwords, stencil, stenciljs, web-component
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@edgeworkscreative/pwned-password
- Size: 95.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README

# Pwned Password Component
Web component built with [Stencil](https://stenciljs.com) that utilizes the [Have I Been Pwned API](https://haveibeenpwned.com) to prevent the use of passwords found in previous data breaches.
Only the first 5 characters of the SHA-1 hash are sent to [Have I Been Pwned](https://haveibeenpwned.com/API/v2#SearchingPwnedPasswordsByRange).
[DEMO](https://jsfiddle.net/91abpLr8/)
## Using the Pwned Password component on your site
Simply place this script tag in the `` of your website:
```html````
Now you can use the component anywhere in the body of your site:
```html
```
```javascript
document.addEventListener('pwnedPasswordFound', (e) => {
if (e.detail === 0) {
let password = e.srcElement.querySelector('input').value;
console.log('Password hasn\'t been pwned - submit your form');
} else {
alert(`Password has been pwned ${e.detail} times!`);
}
})
```