CJVT updates August and September 2026
This commit is contained in:
@@ -2,6 +2,7 @@ const router = require('express-promise-router')()
|
||||
const user = require('../../../controllers/users')
|
||||
const users = require('../../../controllers/api/v1/users')
|
||||
const userAuth = require('../../../middleware/user')
|
||||
const oidc = require('../../../controllers/oidc')
|
||||
|
||||
// Validate and create a new user.
|
||||
router.post('/register', user.register)
|
||||
@@ -15,6 +16,13 @@ router.post('/reset-password-init', user.generateResetPasswordToken)
|
||||
// Validate new passwords, change if successful and sign the user in.
|
||||
router.post('/reset-password-submit', user.changePassword)
|
||||
|
||||
// Create a brand-new SSO account from the session-stored IdP claims, and sign the user in.
|
||||
router.post('/create-profile', oidc.createProfileSubmit)
|
||||
|
||||
// Confirm the matched local account's password, then permanently convert it into an SSO-only
|
||||
// account (IdP-derived name/username, local password removed).
|
||||
router.post('/convert-account', oidc.convertAccountSubmit)
|
||||
|
||||
// Find user by username or email in dictionary or admin console.
|
||||
router.get(
|
||||
'/addUser',
|
||||
@@ -41,6 +49,11 @@ router.post('/basic-data', users.updateBasicData)
|
||||
router.post('/password', users.updatePassword)
|
||||
|
||||
// Delete user profile of the requesting user.
|
||||
// TODO This route has no explicit isAuthenticated middleware, unlike the admin-only routes above
|
||||
// - it relies entirely on req.user.id throwing inside the controller when req.user is undefined,
|
||||
// which surfaces as an unhandled 500 rather than a clean 401/403 (see the general API-auth TODO
|
||||
// in routes/api/index.js). Since this endpoint permanently destroys account data, it deserves an
|
||||
// explicit auth check of its own rather than an implicit crash-as-guard.
|
||||
router.delete('/current', users.deleteCurrent)
|
||||
|
||||
module.exports = router
|
||||
|
||||
Reference in New Issue
Block a user