Improved email validation in user search module. (#5804)

This commit is contained in:
Bianca Nenciu 2018-05-06 12:39:59 +03:00 committed by Régis Hanol
parent 738f3f5229
commit 71f74c0b28

View File

@ -1,5 +1,6 @@
import { CANCELLED_STATUS } from 'discourse/lib/autocomplete';
import { userPath } from 'discourse/lib/url';
import { emailValid } from 'discourse/lib/utilities';
var cache = {},
cacheTopicId,
@ -61,7 +62,7 @@ function organizeResults(r, options) {
});
}
if (!options.disallowEmails && options.term.match(/@/)) {
if (!options.disallowEmails && emailValid(options.term)) {
let e = { username: options.term };
emails = [ e ];
results.push(e);