mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	use includes instead of indexOf
use _.uniq instead of filter&indexOf
This commit is contained in:
		| @@ -221,7 +221,7 @@ authenticationController.login = function (req, res, next) { | ||||
|  | ||||
| 	var loginWith = meta.config.allowLoginWith || 'username-email'; | ||||
|  | ||||
| 	if (req.body.username && utils.isEmailValid(req.body.username) && loginWith.indexOf('email') !== -1) { | ||||
| 	if (req.body.username && utils.isEmailValid(req.body.username) && loginWith.includes('email')) { | ||||
| 		async.waterfall([ | ||||
| 			function (next) { | ||||
| 				user.getUsernameByEmail(req.body.username, next); | ||||
| @@ -231,7 +231,7 @@ authenticationController.login = function (req, res, next) { | ||||
| 				continueLogin(req, res, next); | ||||
| 			}, | ||||
| 		], next); | ||||
| 	} else if (loginWith.indexOf('username') !== -1 && !validator.isEmail(req.body.username)) { | ||||
| 	} else if (loginWith.includes('username') && !validator.isEmail(req.body.username)) { | ||||
| 		continueLogin(req, res, next); | ||||
| 	} else { | ||||
| 		var err = '[[error:wrong-login-type-' + loginWith + ']]'; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user