Skip to content

Commit

Permalink
Added README for user-accounts example
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Pruitt committed Jul 11, 2014
1 parent 9a917e2 commit 527bae8
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
39 changes: 39 additions & 0 deletions user-accounts/README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,43 @@

Notes:

This example shows the usage of:

* The user plugin
* The auth plugin
* The admin plugin
* The data-editor plugin

An express server serves the static register page as the starting-point
of the example. The registration functionality is handled by the seneca-auth
plugin, which takes the requests to 'auth/*', verifies the inputs, and redirects to the account page.

The multi-page app login shows how to use ejs templates and the seneca-auth
plugin to verify users and conditionally redirect on verification. A few
users have been created for convenience using the seneca-user registration
in app.js.

The single-page login shows how to verify users using client-side ajax calls
to seneca-auth. Notice how it still uses a call to the /auth/login action
internally, and then manipulates the DOM through the callback function.

There are also options for logging in with Twitter and Facebook. These
options are available by creating a config.mine.js file with Twitter and
Facebook OAuth keys. seneca-auth uses these keys to authenticate the user,
using the same pattern as regular user authentication.

For more questions about the seneca-auth plugin, check out
https://github.com/rjrodger/seneca-auth

To learn more about the seneca.pin() method, check out
http://senecajs.org/api.html#long-m-pin (more documentation soon)

Feel free to contact me on Twitter if you have any questions! :) @rjrodger





Create config:

Copy config.template.js to config.mine.js
Expand Down
4 changes: 2 additions & 2 deletions user-accounts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ seneca.use('auth',{
register: {
win: '/account',
fail: '/#failed'
},
}
}
})

Expand Down Expand Up @@ -95,7 +95,7 @@ u.register({nick:'a1',name:'na1',email:'[email protected]',password:'a1',active:tru
// create a HTTP server using the core Node API
// this lets the admin plugin use web sockets
var server = http.createServer(app)
server.listen( options.main.port )
server.listen( options.main ? options.main.port : 3000 )

// visit http://localhost[:port]/admin to see the admin page
// you'll need to logged in as an admin - user 'a1' above
Expand Down
1 change: 0 additions & 1 deletion user-accounts/public/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="/js/util/browser.js"></script>
<script src="/js/user-accounts.js"></script>
</head>
<body>
Expand Down

0 comments on commit 527bae8

Please sign in to comment.