free-be-account 0.0.1 → 0.0.2
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.
- package/index.js +3 -2
- package/package.json +1 -1
- package/routers/mgmt/route.js +5 -5
package/index.js
CHANGED
|
@@ -605,11 +605,12 @@ module.exports = {
|
|
|
605
605
|
// Password: password,
|
|
606
606
|
Enabled: true,
|
|
607
607
|
Deleted: false,
|
|
608
|
-
}
|
|
609
|
-
if (err) { return done(err); }
|
|
608
|
+
}).then((user) => {
|
|
610
609
|
if (!user) { return done(null, false); }
|
|
611
610
|
if (!verifyPassword(password, user.Password, m.config.pwdEncryptMethod || 'md5')) { return done(null, false); }
|
|
612
611
|
return done(null, user);
|
|
612
|
+
}).catch((err) => {
|
|
613
|
+
return done(err);
|
|
613
614
|
});
|
|
614
615
|
}
|
|
615
616
|
));
|
package/package.json
CHANGED
package/routers/mgmt/route.js
CHANGED
|
@@ -77,7 +77,7 @@ router.get('/', async (req, res, next) => {
|
|
|
77
77
|
for (let i = 0; i < res.locals.data.docs.length; i += 1) {
|
|
78
78
|
const doc = res.locals.data.docs[i];
|
|
79
79
|
if (doc && doc.Org) {
|
|
80
|
-
const org = await app.models.organization.findOne({ id: doc.Org });
|
|
80
|
+
const org = await res.app.models.organization.findOne({ id: doc.Org });
|
|
81
81
|
if (org) {
|
|
82
82
|
doc.Org = {
|
|
83
83
|
id: org.id,
|
|
@@ -172,13 +172,13 @@ router.post('/audit',
|
|
|
172
172
|
// set permission
|
|
173
173
|
// try to use default account permission in the config first
|
|
174
174
|
// if not found use the permission of the org of the account (if have org module loaded)
|
|
175
|
-
if (req.body.Status === app.modules.account.AccountAuditStatus.Passed && req.body.id) {
|
|
176
|
-
const account = await app.models.account.findOne({ id: req.body.id });
|
|
175
|
+
if (req.body.Status === res.app.modules.account.AccountAuditStatus.Passed && req.body.id) {
|
|
176
|
+
const account = await res.app.models.account.findOne({ id: req.body.id });
|
|
177
177
|
if (account && account.Org) {
|
|
178
|
-
const accountOrg = await app.models.organization.findOne({ id: account.Org });
|
|
178
|
+
const accountOrg = await res.app.models.organization.findOne({ id: account.Org });
|
|
179
179
|
if (accountOrg && accountOrg.Permission) {
|
|
180
180
|
const p = Object.assign({}, accountOrg.Permission);
|
|
181
|
-
if (app.modules.account.utils.clearPermission(p)) {
|
|
181
|
+
if (res.app.modules.account.utils.clearPermission(p)) {
|
|
182
182
|
const op = res.locals.CURD.find(op => op.method === 'U' && op.model === 'account');
|
|
183
183
|
if (op) {
|
|
184
184
|
op.ctx.body.Permission = p;
|