fixes bug with first-register route

This commit is contained in:
James
2020-04-08 08:59:38 -04:00
parent 2eae02ed03
commit f7e72d28f7
2 changed files with 2 additions and 2 deletions

2
.vscode/launch.json vendored
View File

@@ -8,7 +8,7 @@
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/demo/init.js"
"program": "${workspaceFolder}/demo/server.js"
}
]
}

View File

@@ -15,7 +15,7 @@ module.exports = (config, User) => ({
register: (req, res, next) => {
const usernameField = config.user.auth.useAsUsername;
User.register(new User({ usernameField: req.body[usernameField] }), req.body.password, (err, user) => {
User.register(new User({ [usernameField]: req.body[usernameField] }), req.body.password, (err, user) => {
if (err) {
const error = new APIError('Authentication error', httpStatus.UNAUTHORIZED);
return next(error);