Merge branch 'develop/1.1.4' into chore/icons-and-settings

This commit is contained in:
Marquis Kurt 2020-10-01 13:21:19 -04:00
commit dd7b3d7b78
No known key found for this signature in database
GPG Key ID: 725636D259F5402D
2 changed files with 8 additions and 8 deletions

View File

@ -1,7 +1,7 @@
{
"name": "hyperspace",
"productName": "Hyperspace Desktop",
"version": "1.1.3",
"version": "1.1.4",
"description": "A beautiful, fluffy client for the fediverse",
"author": "Marquis Kurt <hyperspacedev@marquiskurt.net>",
"repository": "https://github.com/hyperspacedev/hyperspace.git",

View File

@ -285,6 +285,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
* @param user The string to update the state to
*/
updateUserInfo(user: string) {
this.checkForErrors(user);
this.setState({ user });
}
@ -415,7 +416,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
*/
startLogin() {
// Check if we have errored
let error = this.checkForErrors();
let error = this.checkForErrors(this.state.user);
// If we didn't, create the Hyperspace app to register onto that Mastodon
// server.
@ -535,20 +536,20 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
/**
* Check the user input string for any possible errors
*/
checkForErrors(): boolean {
checkForErrors(username: string): boolean {
let userInputError = false;
let userInputErrorMessage = "";
// Is the user string blank?
if (this.state.user === "") {
if (username === "") {
userInputError = true;
userInputErrorMessage = "Username cannot be blank.";
this.setState({ userInputError, userInputErrorMessage });
return true;
} else {
if (this.state.user.includes("@")) {
if (username.includes("@")) {
if (this.state.federates && this.state.federates === true) {
let baseUrl = this.state.user.split("@")[1];
let baseUrl = username.split("@")[1];
// Is the user's domain in the disallowed list?
if (inDisallowedDomains(baseUrl)) {
@ -581,7 +582,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
});
}
} else if (
this.state.user.includes(
username.includes(
this.state.registerBase ?? "mastodon.social"
)
) {
@ -772,7 +773,6 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
onChange={event => this.updateUserInfo(event.target.value)}
onKeyDown={event => this.watchUsernameField(event)}
error={this.state.userInputError}
onBlur={() => this.checkForErrors()}
InputProps={{
startAdornment: (
<InputAdornment position="start">@</InputAdornment>