@cedarjs/auth-dbauth-setup 8.0.0-canary.3274 → 8.0.0-canary.3285

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -231,6 +231,42 @@ export const handler = async (
231
231
  },
232
232
  }
233
233
 
234
+ const changePasswordOptions: DbAuthHandlerOptions['changePassword'] = {
235
+ // handler() is invoked after a logged in user has entered their current
236
+ // password correctly and the new password has been saved to the database.
237
+ // This is a good place to let the user know, by email for example, that
238
+ // their password was changed.
239
+ //
240
+ // Returning anything truthy keeps the user logged in. Return `false` to
241
+ // log them out, and in the Change Password page redirect the user to the
242
+ // login page.
243
+ handler: (_user) => {
244
+ // TODO: Send an email/message to the user letting them know that their
245
+ // password was changed. When you implement this, change `_user` to
246
+ // `user` in the function arguments above.
247
+
248
+ return true
249
+ },
250
+
251
+ // If `false` then the new password MUST be different from the current one
252
+ allowReusedPassword: false,
253
+
254
+ errors: {
255
+ // the current password was not provided
256
+ currentPasswordRequired: 'Current password is required',
257
+ // the new password was not provided
258
+ newPasswordRequired: 'New password is required',
259
+ // the current password is not correct
260
+ incorrectCurrentPassword: 'Current password is incorrect',
261
+ // the user doesn't have a password yet (they signed up with a third
262
+ // party login provider, for example)
263
+ passwordNotSet:
264
+ 'This account does not have a password. Use "Forgot password" to set one',
265
+ // new password is the same as the current password
266
+ reusedPassword: 'Must choose a new password',
267
+ },
268
+ }
269
+
234
270
  interface UserAttributes {
235
271
  name: string
236
272
  }
@@ -317,6 +353,7 @@ export const handler = async (
317
353
  name: cookieName,
318
354
  },
319
355
 
356
+ changePassword: changePasswordOptions,
320
357
  forgotPassword: forgotPasswordOptions,
321
358
  login: loginOptions,
322
359
  resetPassword: resetPasswordOptions,
@@ -102,6 +102,42 @@ export const handler = async (
102
102
  },
103
103
  }
104
104
 
105
+ const changePasswordOptions: DbAuthHandlerOptions['changePassword'] = {
106
+ // handler() is invoked after a logged in user has entered their current
107
+ // password correctly and the new password has been saved to the database.
108
+ // This is a good place to let the user know, by email for example, that
109
+ // their password was changed.
110
+ //
111
+ // Returning anything truthy keeps the user logged in. Return `false` to
112
+ // log them out, and in the Change Password page redirect the user to the
113
+ // login page.
114
+ handler: (_user) => {
115
+ // TODO: Send an email/message to the user letting them know that their
116
+ // password was changed. When you implement this, change `_user` to
117
+ // `user` in the function arguments above.
118
+
119
+ return true
120
+ },
121
+
122
+ // If `false` then the new password MUST be different from the current one
123
+ allowReusedPassword: false,
124
+
125
+ errors: {
126
+ // the current password was not provided
127
+ currentPasswordRequired: 'Current password is required',
128
+ // the new password was not provided
129
+ newPasswordRequired: 'New password is required',
130
+ // the current password is not correct
131
+ incorrectCurrentPassword: 'Current password is incorrect',
132
+ // the user doesn't have a password yet (they signed up with a third
133
+ // party login provider, for example)
134
+ passwordNotSet:
135
+ 'This account does not have a password. Use "Forgot password" to set one',
136
+ // new password is the same as the current password
137
+ reusedPassword: 'Must choose a new password',
138
+ },
139
+ }
140
+
105
141
  interface UserAttributes {
106
142
  name: string
107
143
  }
@@ -197,6 +233,7 @@ export const handler = async (
197
233
  name: cookieName,
198
234
  },
199
235
 
236
+ changePassword: changePasswordOptions,
200
237
  forgotPassword: forgotPasswordOptions,
201
238
  login: loginOptions,
202
239
  resetPassword: resetPasswordOptions,
@@ -222,6 +222,42 @@ export const handler = async (
222
222
  },
223
223
  }
224
224
 
225
+ const changePasswordOptions: DbAuthHandlerOptions['changePassword'] = {
226
+ // handler() is invoked after a logged in user has entered their current
227
+ // password correctly and the new password has been saved to the database.
228
+ // This is a good place to let the user know, by email for example, that
229
+ // their password was changed.
230
+ //
231
+ // Returning anything truthy keeps the user logged in. Return `false` to
232
+ // log them out, and in the Change Password page redirect the user to the
233
+ // login page.
234
+ handler: (_user) => {
235
+ // TODO: Send an email/message to the user letting them know that their
236
+ // password was changed. When you implement this, change `_user` to
237
+ // `user` in the function arguments above.
238
+
239
+ return true
240
+ },
241
+
242
+ // If `false` then the new password MUST be different from the current one
243
+ allowReusedPassword: false,
244
+
245
+ errors: {
246
+ // the current password was not provided
247
+ currentPasswordRequired: 'Current password is required',
248
+ // the new password was not provided
249
+ newPasswordRequired: 'New password is required',
250
+ // the current password is not correct
251
+ incorrectCurrentPassword: 'Current password is incorrect',
252
+ // the user doesn't have a password yet (they signed up with a third
253
+ // party login provider, for example)
254
+ passwordNotSet:
255
+ 'This account does not have a password. Use "Forgot password" to set one',
256
+ // new password is the same as the current password
257
+ reusedPassword: 'Must choose a new password',
258
+ },
259
+ }
260
+
225
261
  interface UserAttributes {
226
262
  name: string
227
263
  }
@@ -307,6 +343,7 @@ export const handler = async (
307
343
  name: cookieName,
308
344
  },
309
345
 
346
+ changePassword: changePasswordOptions,
310
347
  forgotPassword: forgotPasswordOptions,
311
348
  login: loginOptions,
312
349
  resetPassword: resetPasswordOptions,
@@ -93,6 +93,42 @@ export const handler = async (
93
93
  },
94
94
  }
95
95
 
96
+ const changePasswordOptions: DbAuthHandlerOptions['changePassword'] = {
97
+ // handler() is invoked after a logged in user has entered their current
98
+ // password correctly and the new password has been saved to the database.
99
+ // This is a good place to let the user know, by email for example, that
100
+ // their password was changed.
101
+ //
102
+ // Returning anything truthy keeps the user logged in. Return `false` to
103
+ // log them out, and in the Change Password page redirect the user to the
104
+ // login page.
105
+ handler: (_user) => {
106
+ // TODO: Send an email/message to the user letting them know that their
107
+ // password was changed. When you implement this, change `_user` to
108
+ // `user` in the function arguments above.
109
+
110
+ return true
111
+ },
112
+
113
+ // If `false` then the new password MUST be different from the current one
114
+ allowReusedPassword: false,
115
+
116
+ errors: {
117
+ // the current password was not provided
118
+ currentPasswordRequired: 'Current password is required',
119
+ // the new password was not provided
120
+ newPasswordRequired: 'New password is required',
121
+ // the current password is not correct
122
+ incorrectCurrentPassword: 'Current password is incorrect',
123
+ // the user doesn't have a password yet (they signed up with a third
124
+ // party login provider, for example)
125
+ passwordNotSet:
126
+ 'This account does not have a password. Use "Forgot password" to set one',
127
+ // new password is the same as the current password
128
+ reusedPassword: 'Must choose a new password',
129
+ },
130
+ }
131
+
96
132
  interface UserAttributes {
97
133
  name: string
98
134
  }
@@ -187,6 +223,7 @@ export const handler = async (
187
223
  name: cookieName,
188
224
  },
189
225
 
226
+ changePassword: changePasswordOptions,
190
227
  forgotPassword: forgotPasswordOptions,
191
228
  login: loginOptions,
192
229
  resetPassword: resetPasswordOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/auth-dbauth-setup",
3
- "version": "8.0.0-canary.3274",
3
+ "version": "8.0.0-canary.3285",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -23,14 +23,14 @@
23
23
  "test:watch": "yarn test --watch"
24
24
  },
25
25
  "dependencies": {
26
- "@cedarjs/cli-helpers": "8.0.0-canary.3274",
27
- "@cedarjs/project-config": "8.0.0-canary.3274",
26
+ "@cedarjs/cli-helpers": "8.0.0-canary.3285",
27
+ "@cedarjs/project-config": "8.0.0-canary.3285",
28
28
  "@prisma/internals": "7.10.0",
29
29
  "prompts": "2.4.2",
30
30
  "termi-link": "1.1.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@cedarjs/framework-tools": "8.0.0-canary.3274",
33
+ "@cedarjs/framework-tools": "8.0.0-canary.3285",
34
34
  "@types/yargs": "17.0.35",
35
35
  "memfs": "4.79.0",
36
36
  "nodemon": "3.1.14",