mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2026-03-10 21:25:04 +00:00
Signup is working
This commit is contained in:
@@ -123,7 +123,7 @@ export class Login extends Component {
|
||||
<TextField
|
||||
id="password"
|
||||
name="password"
|
||||
label="password*"
|
||||
label="Password*"
|
||||
className={classes.textField}
|
||||
value={this.state.password}
|
||||
helperText={errors.password}
|
||||
|
||||
@@ -67,6 +67,7 @@ export class Signup extends Component {
|
||||
password: this.state.password,
|
||||
confirmPassword: this.state.confirmPassword
|
||||
};
|
||||
console.log(signupData)
|
||||
this.props.signupUser(signupData, this.props.history);
|
||||
};
|
||||
|
||||
@@ -95,6 +96,18 @@ export class Signup extends Component {
|
||||
Create a new account
|
||||
</Typography>
|
||||
<form noValidate onSubmit={this.handleSubmit}>
|
||||
<TextField
|
||||
id="handle"
|
||||
name="handle"
|
||||
label="Username*"
|
||||
className={classes.textField}
|
||||
value={this.state.handle}
|
||||
helperText={errors.handle}
|
||||
error={errors.handle ? true : false}
|
||||
variant="outlined"
|
||||
onChange={this.handleChange}
|
||||
fullWidth
|
||||
/>
|
||||
<TextField
|
||||
id="email"
|
||||
name="email"
|
||||
@@ -110,7 +123,7 @@ export class Signup extends Component {
|
||||
<TextField
|
||||
id="password"
|
||||
name="password"
|
||||
label="password*"
|
||||
label="Password*"
|
||||
className={classes.textField}
|
||||
value={this.state.password}
|
||||
helperText={errors.password}
|
||||
@@ -120,6 +133,19 @@ export class Signup extends Component {
|
||||
onChange={this.handleChange}
|
||||
fullWidth
|
||||
/>
|
||||
<TextField
|
||||
id="confirmPassword"
|
||||
name="confirmPassword"
|
||||
label="Confirm Password*"
|
||||
className={classes.textField}
|
||||
value={this.state.confirmPassword}
|
||||
helperText={errors.confirmPassword}
|
||||
error={errors.confirmPassword ? true : false}
|
||||
type="password"
|
||||
variant="outlined"
|
||||
onChange={this.handleChange}
|
||||
fullWidth
|
||||
/>
|
||||
<Button
|
||||
type="submit"
|
||||
variant="contained"
|
||||
|
||||
@@ -50,6 +50,12 @@ export class edit extends Component {
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
if (err.response.status === 403) {
|
||||
alert("You are not logged in");
|
||||
// TODO: Redirect them, to the profile they are trying to edit
|
||||
// If they are on /itsjimmy/edit, they will be redirected to /itsjimmy
|
||||
this.props.history.push('../');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -104,6 +110,7 @@ export class edit extends Component {
|
||||
// Updates the state whenever one of the textboxes changes.
|
||||
// The key is the name of the textbox and the value is the
|
||||
// value in the text box.
|
||||
// Also sets errors to null of textboxes that have been edited
|
||||
handleChange = (event) => {
|
||||
this.setState({
|
||||
[event.target.name]: event.target.value,
|
||||
|
||||
Reference in New Issue
Block a user