Merge pull request #3934 from strongloop/fix/crash-in-verifyUserRelations
fix: resolve customAccessToken warning error that causes app to crash
This commit is contained in:
commit
cd1b31920e
|
@ -497,8 +497,10 @@ app._verifyAuthModelRelations = function() {
|
||||||
function verifyUserRelations(Model) {
|
function verifyUserRelations(Model) {
|
||||||
const hasManyTokens = Model.relations && Model.relations.accessTokens;
|
const hasManyTokens = Model.relations && Model.relations.accessTokens;
|
||||||
|
|
||||||
|
const relationsConfig = Model.settings.relations || {};
|
||||||
|
const hasPolyMorphicTokens = (relationsConfig.accessTokens || {}).polymorphic;
|
||||||
// display a temp warning message for users using multiple users config
|
// display a temp warning message for users using multiple users config
|
||||||
if (hasManyTokens.polymorphic) {
|
if (hasPolyMorphicTokens) {
|
||||||
console.warn(
|
console.warn(
|
||||||
'The app configuration follows the multiple user models setup ' +
|
'The app configuration follows the multiple user models setup ' +
|
||||||
'as described in http://ibm.biz/setup-loopback-auth',
|
'as described in http://ibm.biz/setup-loopback-auth',
|
||||||
|
@ -508,7 +510,6 @@ app._verifyAuthModelRelations = function() {
|
||||||
|
|
||||||
if (hasManyTokens) return;
|
if (hasManyTokens) return;
|
||||||
|
|
||||||
const relationsConfig = Model.settings.relations || {};
|
|
||||||
const accessTokenName = (relationsConfig.accessTokens || {}).model;
|
const accessTokenName = (relationsConfig.accessTokens || {}).model;
|
||||||
if (accessTokenName) {
|
if (accessTokenName) {
|
||||||
console.warn(
|
console.warn(
|
||||||
|
|
Loading…
Reference in New Issue