fix should toString userId's
This commit is contained in:
		| @@ -47,7 +47,7 @@ export default function({ models }) { | |||||||
|             modified |             modified | ||||||
|           }); |           }); | ||||||
|         } |         } | ||||||
|         if (identity.userId !== userId) { |         if (identity.userId.toString() !== userId.toString()) { | ||||||
|           return Observable.throw( |           return Observable.throw( | ||||||
|             new Error('An account is already linked to that profile') |             new Error('An account is already linked to that profile') | ||||||
|           ); |           ); | ||||||
|   | |||||||
| @@ -1,10 +1,30 @@ | |||||||
|  | const pathsOfNoReturn = [ | ||||||
|  |   'link', | ||||||
|  |   'auth', | ||||||
|  |   'login', | ||||||
|  |   'logout', | ||||||
|  |   'signin', | ||||||
|  |   'signup', | ||||||
|  |   'fonts', | ||||||
|  |   'favicon', | ||||||
|  |   'js', | ||||||
|  |   'css' | ||||||
|  | ]; | ||||||
|  |  | ||||||
|  | const pathsOfNoReturnRegex = new RegExp(pathsOfNoReturn.join('|'), 'i'); | ||||||
|  |  | ||||||
| export default function addReturnToUrl() { | export default function addReturnToUrl() { | ||||||
|   return function(req, res, next) { |   return function(req, res, next) { | ||||||
|     // Remember original destination before login. |     // Remember original destination before login. | ||||||
|     var path = req.path.split('/')[1]; |     var path = req.path.split('/')[1]; | ||||||
|     if (/auth|login|logout|signin|signup|fonts|favicon/i.test(path)) { |  | ||||||
|  |     if (req.method !== 'GET') { | ||||||
|       return next(); |       return next(); | ||||||
|     } else if (/\/stories\/\w+/i.test(req.path)) { |     } | ||||||
|  |     if (pathsOfNoReturnRegex.test(path)) { | ||||||
|  |       return next(); | ||||||
|  |     } | ||||||
|  |     if (/\/stories\/\w+/i.test(req.path)) { | ||||||
|       return next(); |       return next(); | ||||||
|     } |     } | ||||||
|     req.session.returnTo = req.path; |     req.session.returnTo = req.path; | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ extends ../layout | |||||||
| block content | block content | ||||||
|     script. |     script. | ||||||
|         var challengeName = 'Account View' |         var challengeName = 'Account View' | ||||||
|     .panel.panel-info(ng-controller="profileValidationController") |     .panel.panel-info | ||||||
|         .panel-heading.text-center Manage your account here |         .panel-heading.text-center Manage your account here | ||||||
|         .panel-body |         .panel-body | ||||||
|             .row |             .row | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user