Skip to content

Commit

Permalink
docs: added events and features
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias Peter authored and Mathias Peter committed Oct 31, 2013
1 parent 9f6bea2 commit 43ac675
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 5 deletions.
91 changes: 88 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ This Modules makes it easy to create a secure email user login with verification

* Double opt in for emails
* Connect your own Database
* Crypted passwords with the most secure `bcrypt` algorithm.
* Crypted token content. Default algorithm is **des3** but you can use any node algorythm node supports by setting the config `tokenAlgorithm` e.g. **aes128**.
* Integrated mail service by `tcs_node_mail_client` ( uses AWS mail services )

## Register sequence
Expand Down Expand Up @@ -221,9 +223,7 @@ to create the AuthApp call `new` with the configuared `UserStore` and the module
* **mailAppId** ( `String` ): The `tcs_node_mail_client` app id.
* **mailConfig** ( `Object` ): The `tcs_node_mail_client` configuration.
Details: [tcs_mail_node_client]( https://github.com/mpneuried/tcs_mail_node_client ).
* **tokenAlgorithm** ( `String`- *optional; default = `des3`* ): The crypting algorythm to crypt the data inside a token.
# Methods
Expand Down Expand Up @@ -324,6 +324,84 @@ This method make use of the `UserStore.setUserCredentials()` Method.
* **error** ( `String|Error|Object` ): A general error object wich.
* **userData** ( `String|Number|Object` ): Additional data you can use after a successful activation. E.g. Data to create your session.
# Events
### `connect`
Fired on the connect event of redis
### `disconnect`
Fired on a redis disconnection
### `error`
Fired on a redis general connection error
### `ready`
Fired until the module is ready to use.
Before redis has been connected and the the userStore has been checked.
### `login`
Fired after a succesfull login.
####Parameter:
* **userData** ( `String|Number|Object` ): Additional data you can use after a successful login. E.g. Data to create your session.
### `register`
Fired after created a new `register` token.
####Parameter:
* **token** ( `String` ): The generated token.
* **email** ( `String` ): The receiver mail
### `forgot`
Fired after created a new `forgot` token.
####Parameter:
* **token** ( `String` ): The generated token.
* **email** ( `String` ): The receiver mail
### `changemail`
Fired after created a new `changemail` token.
####Parameter:
* **token** ( `String` ): The generated token.
* **current_email** ( `String` ): The users current email.
* **new_email** ( `String` ): The new email to activate.
### `activated`
Fired after a token has been processed.
####Parameter:
* **token** ( `String` ): The processed token.
* **tokenData** ( `Object` ): The data of the token.
* **type** ( `String` - *enum `register`, `forgot`, `changemail`* ): Token type
* **email** ( `String` ): The requesting mail
* **time** ( `Number` ): The creation timestamp in ms
* **[newemail]** ( `String` - *optional* ): The mail to set for `type` = `changemail`.mail
### `mail`
Fired after a succesfull login.
####Parameter:
* **email** ( `String` ): The receiver mail
* **mailData** ( `Object` ): The data generated by the method `UserStore.getMailContent()`
# User Store
### `UserStore.getUserCredentials( email, callback )`
Expand Down Expand Up @@ -413,6 +491,13 @@ Get the content data for a mail.
|v0.1.0|2013-10-30|Initial commit|
## Related Projects
|Name|Description|
|:--|:--|
|[**tcs_node_mail_client**](https://github.com/mpneuried/tcs_mail_node_client)|Module to simply send mails by using the TCS mail Webservice (**node-tcs-de**)|
|[**node-tcs-de**](https://github.com/smrchy/node.tcs.de)|Sends out an email via Amazon SES.|
## The MIT License (MIT)
Copyright © 2013 Mathias Peter, http://www.tcs.de
Expand Down
2 changes: 1 addition & 1 deletion _src/lib/auth.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ module.exports = class Auth extends require( "./basic" )
cb( err )
return
@debug "created token `#{token}` of type `#{tokenData.type}` for mail `#{tokenData.email}`"
@emit "activated", token, tokenData
cb( null, userData )
@emit tokenData.type, token, tokenData.email, tokenData.newemail
return
return
return
Expand Down
2 changes: 1 addition & 1 deletion lib/auth.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 43ac675

Please sign in to comment.