Publish: validate names as the user types
Rejects invalid characters and pops up a form hint explaining what characters are allowed.
This commit is contained in:
parent
5af7916b20
commit
e0d0c3f915
1 changed files with 7 additions and 2 deletions
|
@ -161,14 +161,19 @@ var PublishPage = React.createClass({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!lbry.nameIsValid(rawName, false)) {
|
||||||
|
this.refs.name.showAdvice('LBRY names must contain only letters, numbers and dashes.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
rawName: rawName,
|
rawName: rawName,
|
||||||
});
|
});
|
||||||
|
|
||||||
var name = lbry.formatName(rawName);
|
var name = rawName.toLowerCase();
|
||||||
|
|
||||||
lbry.resolveName(name, (info) => {
|
lbry.resolveName(name, (info) => {
|
||||||
if (name != lbry.formatName(this.refs.name.getValue())) {
|
if (name != this.refs.name.getValue().toLowerCase()) {
|
||||||
// A new name has been typed already, so bail
|
// A new name has been typed already, so bail
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue