fix: resolve customAccessToken warning error that causes app to crash
In the present implementation verifyUserRelations(Model) sets a const hasManyTokens which seems to resolve to a boolean or undefined, so checking hasManyTokens.polymorphic throws an error. It seems the intention is to check whether the the following conditions are met: 1. a model has a hasMany accessTokens relation 2. that relation is polymorphic The proposed change should resolve correctly for any models that meet this criteria.
This commit is contained in:
parent
c9913927e5
commit
778395e6d5
|
@ -460,7 +460,7 @@ app._verifyAuthModelRelations = function() {
|
|||
const hasManyTokens = Model.relations && Model.relations.accessTokens;
|
||||
|
||||
// display a temp warning message for users using multiple users config
|
||||
if (hasManyTokens.polymorphic) {
|
||||
if (hasManyTokens && Model.settings.relations.accessTokens.polymorphic) {
|
||||
console.warn(
|
||||
'The app configuration follows the multiple user models setup ' +
|
||||
'as described in http://ibm.biz/setup-loopback-auth',
|
||||
|
|
Loading…
Reference in New Issue