mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 21:24:59 +08:00
Check to make sure email addresses look roughly valid before inviting them to room
Fixes https://github.com/vector-im/riot-web/issues/6854
This commit is contained in:
parent
a92d2902c4
commit
d062e2c2f4
@ -23,6 +23,7 @@ import MatrixClientPeg from '../../../MatrixClientPeg';
|
|||||||
import Promise from 'bluebird';
|
import Promise from 'bluebird';
|
||||||
import { addressTypes, getAddressType } from '../../../UserAddress.js';
|
import { addressTypes, getAddressType } from '../../../UserAddress.js';
|
||||||
import GroupStore from '../../../stores/GroupStore';
|
import GroupStore from '../../../stores/GroupStore';
|
||||||
|
import * as Email from "../../../email";
|
||||||
|
|
||||||
const TRUNCATE_QUERY_LIST = 40;
|
const TRUNCATE_QUERY_LIST = 40;
|
||||||
const QUERY_USER_DIRECTORY_DEBOUNCE_MS = 200;
|
const QUERY_USER_DIRECTORY_DEBOUNCE_MS = 200;
|
||||||
@ -419,6 +420,10 @@ module.exports = React.createClass({
|
|||||||
// a perfectly valid address if there are close matches.
|
// a perfectly valid address if there are close matches.
|
||||||
const addrType = getAddressType(query);
|
const addrType = getAddressType(query);
|
||||||
if (this.props.validAddressTypes.includes(addrType)) {
|
if (this.props.validAddressTypes.includes(addrType)) {
|
||||||
|
if (addrType === 'email' && !Email.looksValid(query)) {
|
||||||
|
this.setState({searchError: _t("That doesn't look like a valid email address")});
|
||||||
|
return;
|
||||||
|
}
|
||||||
suggestedList.unshift({
|
suggestedList.unshift({
|
||||||
addressType: addrType,
|
addressType: addrType,
|
||||||
address: query,
|
address: query,
|
||||||
|
@ -871,6 +871,7 @@
|
|||||||
"Matrix ID": "Matrix ID",
|
"Matrix ID": "Matrix ID",
|
||||||
"Matrix Room ID": "Matrix Room ID",
|
"Matrix Room ID": "Matrix Room ID",
|
||||||
"email address": "email address",
|
"email address": "email address",
|
||||||
|
"That doesn't look like a valid email address": "That doesn't look like a valid email address",
|
||||||
"You have entered an invalid address.": "You have entered an invalid address.",
|
"You have entered an invalid address.": "You have entered an invalid address.",
|
||||||
"Try using one of the following valid address types: %(validTypesList)s.": "Try using one of the following valid address types: %(validTypesList)s.",
|
"Try using one of the following valid address types: %(validTypesList)s.": "Try using one of the following valid address types: %(validTypesList)s.",
|
||||||
"Preparing to send logs": "Preparing to send logs",
|
"Preparing to send logs": "Preparing to send logs",
|
||||||
@ -912,7 +913,6 @@
|
|||||||
"You've previously used a newer version of Riot on %(host)s. To use this version again with end to end encryption, you will need to sign out and back in again. ": "You've previously used a newer version of Riot on %(host)s. To use this version again with end to end encryption, you will need to sign out and back in again. ",
|
"You've previously used a newer version of Riot on %(host)s. To use this version again with end to end encryption, you will need to sign out and back in again. ": "You've previously used a newer version of Riot on %(host)s. To use this version again with end to end encryption, you will need to sign out and back in again. ",
|
||||||
"Incompatible Database": "Incompatible Database",
|
"Incompatible Database": "Incompatible Database",
|
||||||
"Continue With Encryption Disabled": "Continue With Encryption Disabled",
|
"Continue With Encryption Disabled": "Continue With Encryption Disabled",
|
||||||
"Failed to indicate account erasure": "Failed to indicate account erasure",
|
|
||||||
"Unknown error": "Unknown error",
|
"Unknown error": "Unknown error",
|
||||||
"Incorrect password": "Incorrect password",
|
"Incorrect password": "Incorrect password",
|
||||||
"Deactivate Account": "Deactivate Account",
|
"Deactivate Account": "Deactivate Account",
|
||||||
|
Loading…
Reference in New Issue
Block a user