Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikeumus/docpad-plugin-persona
⚠ IN PROGRESS. NOT FUNCTIONAL. The express-persona npm module as a docpad plugin.
https://github.com/mikeumus/docpad-plugin-persona
Last synced: 25 days ago
JSON representation
⚠ IN PROGRESS. NOT FUNCTIONAL. The express-persona npm module as a docpad plugin.
- Host: GitHub
- URL: https://github.com/mikeumus/docpad-plugin-persona
- Owner: mikeumus
- Created: 2013-01-27T20:01:08.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2020-09-29T14:49:15.000Z (about 4 years ago)
- Last Synced: 2024-04-14T08:04:39.954Z (7 months ago)
- Language: CSS
- Homepage: https://npmjs.org/package/docpad-plugin-persona
- Size: 19.5 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
IN PROGRESS. NON-FUNCTIONAL.
docpad-plugin-persona
=====================### The [express-persona](http://jbuck.github.com/express-persona/ "http://jbuck.github.com/express-persona/") npm module as a [docpad](http://docpad.org/ "http://docpad.org/") plugin.
[Mozilla Persona](https://developer.mozilla.org/en-US/docs/Persona?redirectlocale=en-US&redirectslug=BrowserID "https://developer.mozilla.org/en-US/docs/Persona?redirectlocale=en-US&redirectslug=BrowserID"), formerly called BrowserID, is self described as: "a cross-browser login system for the Web that's easy to use and easy to deploy. It works on all major browsers, and you can get started today."
This docpad plugin uses [jsdom](https://github.com/tmpvar/jsdom "https://github.com/tmpvar/jsdom") to [query](https://developer.mozilla.org/en-US/docs/DOM/Document.querySelectorAll "https://developer.mozilla.org/en-US/docs/DOM/Document.querySelectorAll") the DOM for ".persona-btn" on the [renderDocument](http://docpad.org/docs/events "http://docpad.org/docs/events") docpad event. If it finds it, it'll create a script tag that is the express-persona script:
```javascript
var loginButton = document.querySelectorAll('.persona-btn');loginButton.addEventListener("click", function() {
navigator.id.get(function(assertion) {
if (!assertion) {
return;
}var xhr = new XMLHttpRequest();
xhr.open("POST", "/persona/verify", true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.addEventListener("loadend", function(e) {
try {
var data = JSON.parse(this.response);
if (data.status === "okay") {
// the email address the user logged in with
console.log(data.email);
} else {
console.log("Login failed because " + data.reason);
}
} catch (ex) {
// oh no, we didn't get valid JSON from the server
}
}, false);
xhr.send(JSON.stringify({
assertion: assertion
}));
});
}, false);
```___
##### The "Sign in" button comes in three color options:
Along with a script tag being created, a link tag will be created as well linking the appripiate css file to create a CSS3 Sign In button..class
Button
.css file.persona-btn
persona-btn.css" + .dark
persona-dark-btn.css" + .orange
persona-orange-btn.css___
##### Dependencies
jsdom.js
0.2.xexpress
~3.0.6express-persona
0.0.7bal-util
>=1.13.8 <1.14## License
Licensed under the incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT License](http://creativecommons.org/licenses/MIT/)
Copyright © 2013 [MDM Inc.](http://mdm.cm/ "http://mdm.cm/")