mirror of
https://github.com/urbit/shrub.git
synced 2024-12-02 21:34:04 +03:00
validate group names
This commit is contained in:
parent
f4b3dc501f
commit
8c82f1bbff
@ -34,13 +34,20 @@ export class NewScreen extends Component {
|
|||||||
|
|
||||||
onClickCreate() {
|
onClickCreate() {
|
||||||
const { props, state } = this;
|
const { props, state } = this;
|
||||||
if (!state.groupName) {
|
|
||||||
|
let invalidChara = new RegExp(/[^a-z0-9/-]/);
|
||||||
|
|
||||||
|
if (
|
||||||
|
(!state.groupName) || (state.groupName.startsWith("/")) ||
|
||||||
|
(state.groupName.includes("//")) || (invalidChara.test(state.groupName))
|
||||||
|
) {
|
||||||
this.setState({
|
this.setState({
|
||||||
groupNameError: true,
|
groupNameError: true,
|
||||||
inviteError: false
|
inviteError: false
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let group = `/~${window.ship}` + `/${state.groupName}`;
|
let group = `/~${window.ship}` + `/${state.groupName}`;
|
||||||
|
|
||||||
let aud = [];
|
let aud = [];
|
||||||
@ -56,7 +63,7 @@ export class NewScreen extends Component {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
this.setState({
|
this.setState({
|
||||||
inviteError: true,
|
inviteError: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user