Merge branch 'beta4' of github.com:hyperspacedev/hyperspace into electron

This commit is contained in:
Marquis Kurt 2019-05-17 10:15:18 -04:00
commit 157793722f
1 changed files with 23 additions and 11 deletions

View File

@ -1,4 +1,4 @@
import React, { Component } from 'react';
import React, { Component, ChangeEvent } from 'react';
import {withStyles, Paper, Typography, Button, TextField, Fade, Link, CircularProgress, Tooltip, Dialog, DialogTitle, DialogActions, DialogContent} from '@material-ui/core';
import {styles} from './WelcomePage.styles';
import Mastodon from 'megalodon';
@ -82,6 +82,16 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
})
}
componentDidMount() {
if (localStorage.getItem("login")) {
this.getSavedSession();
this.setState({
foundSavedLogin: true
})
this.checkForToken();
}
}
updateUserInfo(user: string) {
this.setState({ user });
}
@ -102,16 +112,6 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
}
}
componentDidMount() {
if (localStorage.getItem("login")) {
this.getSavedSession();
this.setState({
foundSavedLogin: true
})
this.checkForToken();
}
}
getSavedSession() {
let loginData = localStorage.getItem("login");
if (loginData) {
@ -140,6 +140,16 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
}
}
watchUsernameField(event: any) {
if (event.keyCode === 13)
this.startLogin()
}
watchAuthField(event: any) {
if (event.keyCode === 13)
this.authorizeEmergencyLogin()
}
getLoginUser(user: string) {
if (user.includes("@")) {
if (this.state.federates) {
@ -324,6 +334,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
fullWidth
placeholder="example@mastodon.example"
onChange={(event) => this.updateUserInfo(event.target.value)}
onKeyDown={(event) => this.watchUsernameField(event)}
error={this.state.userInputError}
onBlur={() => this.checkForErrors()}
></TextField>
@ -416,6 +427,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
label="Authorization code"
fullWidth
onChange={(event) => this.updateAuthCode(event.target.value)}
onKeyDown={(event) => this.watchAuthField(event)}
></TextField>
</DialogContent>
<DialogActions>