Skip to content

Commit

Permalink
fix: fixed user creation endpoint to properly import groups
Browse files Browse the repository at this point in the history
  • Loading branch information
devnill committed Aug 6, 2019
1 parent 4fb20ef commit 50e115f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/api/endpoint/api/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ export default function(route: Router, auth: IAuth, config: Config): void {
const remoteName = req.remote_user.name;

if (_.isNil(remoteName) === false && _.isNil(name) === false && remoteName === name) {
auth.authenticate(name, password, async function callbackAuthenticate(err, groups): Promise<void> {
auth.authenticate(name, password, async function callbackAuthenticate(err, user): Promise<void> {
if (err) {
logger.trace({ name, err }, 'authenticating for user @{username} failed. Error: @{err.message}');
return next(ErrorCode.getCode(HTTP_STATUS.UNAUTHORIZED, API_ERROR.BAD_USERNAME_PASSWORD));
}

const restoredRemoteUser: RemoteUser = createRemoteUser(name, groups);
const restoredRemoteUser: RemoteUser = createRemoteUser(name, user.groups || []);
const token = await getApiToken(auth, config, restoredRemoteUser, password);

res.status(HTTP_STATUS.CREATED);
Expand Down

0 comments on commit 50e115f

Please sign in to comment.