Skip to content

Commit

Permalink
fix(accounts): api key generated by default on creation. #287
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Dec 23, 2019
1 parent 9ec8293 commit 1f9291e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/controllers/api/v2/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

var _ = require('lodash')
var async = require('async')
var Chance = require('chance')
var apiUtil = require('../apiUtils')
var User = require('../../../models/user')
var Group = require('../../../models/group')
Expand All @@ -27,7 +28,7 @@ accountsApi.create = function (req, res) {
if (!postData) return apiUtil.sendApiError_InvalidPostData(res)

var savedId = null

var chance = new Chance()
async.series(
{
user: function (next) {
Expand All @@ -38,7 +39,8 @@ accountsApi.create = function (req, res) {
password: postData.password,
fullname: postData.fullname,
title: postData.title,
role: postData.role
role: postData.role,
accessToken: chance.hash()
},
function (err, user) {
if (err) return apiUtil.sendApiError(res, 500, err.message)
Expand Down

0 comments on commit 1f9291e

Please sign in to comment.