@@ -44,54 +44,9 @@ npm i -S @accounts/redis
44
44
npm i -S @accounts/sql
45
45
```
46
46
47
- ## Example
47
+ ## Examples
48
48
49
- You can find a working example [ here] ( https://github.com/accounts-js/examples ) .
50
-
51
- ## Emails
52
-
53
- Configuration:
54
- ``` javascript
55
- AccountsServer .config ({
56
- siteUrl: ' https://my-app.com' ,
57
- email: // a valid email config object passed to emailjs
58
- // https://github.com/eleith/emailjs#example-usage---text-only-emails
59
- // You can handle the send of the emails by providing an optional sendMail function
60
- // sendMail: ({ from, to, text, html }): Promise<void>
61
- });
62
- ```
63
-
64
- To overwrite the email templates:
65
- ``` javascript
66
- AccountsServer .
emailTemplates .
from = ' my-app <[email protected] >' ;
67
- AccountsServer .emailTemplates .verifyEmail .subject = (user ) => ` Verify your account email ${ user .profile .lastname } ` ;
68
- AccountsServer .emailTemplates .verifyEmail .text = (user , url ) => ` To verify your account email please click on this link: ${ url} ` ;
69
- ```
70
-
71
- ## Server Side Hooks
72
-
73
- ` @accounts/server ` also exposes hooks, that let you know about actions that happened by the client. every action has a hook for success and error.
74
-
75
- > Server side hooks does not effect the flow on the actions at all - it's just a notification.
76
-
77
- > You can subscribe to each hook multiple time!
78
-
79
- Pass for each hooks a callback function, and each hooks provides a different arguments.
80
-
81
- The following hooks are available:
82
-
83
- * ` onLoginSuccess ` : will call with the login result, an object with: ` ({ sessionId, user, tokens: { accessToken, refreshToken } }) `
84
- * ` onLoginError ` : the callback will call with the ` AccountsError ` object.
85
- * ` onLogoutSuccess ` : will be caled with the logout result: ` (user, session, accessToken) `
86
- * ` onLogoutError ` : the callback will call with the ` AccountsError ` object.
87
- * ` onCreateUserSuccess ` : will call with: ` (userId, userObject) `
88
- * ` onCreateUserError ` : the callback will call with the ` AccountsError ` object.
89
- * ` onResumeSessionSuccess ` : will call with ` (user, accessToken) `
90
- * ` onResumeSessionError ` : the callback will call with the ` AccountsError ` object.
91
- * ` onRefreshTokensSuccess ` : will call with: ` ({ sessionId, user, tokens: { accessToken, refreshToken } }) `
92
- * ` onRefreshTokensError ` : the callback will call with the ` AccountsError ` object.
93
- * ` onImpersonationSuccess ` : will call with: ` (originalUser, impersonationResult: { authorized, user, tokens: { refreshToken, accessToken }}) `
94
- * ` onImpersonationError ` : the callback will call with the ` AccountsError ` object.
49
+ You can find a working examples [ here] ( https://github.com/accounts-js/examples ) .
95
50
96
51
## Contributors
97
52
0 commit comments