fix should toString userId's
This commit is contained in:
		| @@ -47,7 +47,7 @@ export default function({ models }) { | ||||
|             modified | ||||
|           }); | ||||
|         } | ||||
|         if (identity.userId !== userId) { | ||||
|         if (identity.userId.toString() !== userId.toString()) { | ||||
|           return Observable.throw( | ||||
|             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() { | ||||
|   return function(req, res, next) { | ||||
|     // Remember original destination before login. | ||||
|     var path = req.path.split('/')[1]; | ||||
|     if (/auth|login|logout|signin|signup|fonts|favicon/i.test(path)) { | ||||
|  | ||||
|     if (req.method !== 'GET') { | ||||
|       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(); | ||||
|     } | ||||
|     req.session.returnTo = req.path; | ||||
|   | ||||
| @@ -2,7 +2,7 @@ extends ../layout | ||||
| block content | ||||
|     script. | ||||
|         var challengeName = 'Account View' | ||||
|     .panel.panel-info(ng-controller="profileValidationController") | ||||
|     .panel.panel-info | ||||
|         .panel-heading.text-center Manage your account here | ||||
|         .panel-body | ||||
|             .row | ||||
|   | ||||
		Reference in New Issue
	
	Block a user