Skip to content

Commit 32bdecc

Browse files
committed
app.enableAuth: correctly detect attached models
Fix a typo in "app.enableAuth" that caused the method to not detect the situation when e.g. the built-in User model is already attached to a datasource.
1 parent f5acf6a commit 32bdecc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/application.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,10 @@ app.enableAuth = function(options) {
316316
g.f('Authentication requires model %s to be defined.', m));
317317
}
318318

319-
if (m.dataSource || m.app) return;
319+
if (Model.dataSource || Model.app) return;
320320

321+
// Find descendants of Model that are attached,
322+
// for example "Customer" extending "User" model
321323
for (var name in appModels) {
322324
var candidate = appModels[name];
323325
var isSubclass = candidate.prototype instanceof Model;

0 commit comments

Comments
 (0)