2025-04-16 12:02:42 -07:00
|
|
|
import React from "react";
|
|
|
|
|
function SignUpForm() {
|
2025-04-28 11:12:10 -07:00
|
|
|
const authUrl = import.meta.env.VITE_AUTH_URL;
|
|
|
|
|
|
2025-04-16 12:02:42 -07:00
|
|
|
const [state, setState] = React.useState({
|
|
|
|
|
name: "",
|
|
|
|
|
email: "",
|
|
|
|
|
password: "",
|
|
|
|
|
});
|
|
|
|
|
const handleChange = (evt) => {
|
|
|
|
|
const value = evt.target.value;
|
|
|
|
|
setState({
|
|
|
|
|
...state,
|
|
|
|
|
[evt.target.name]: value,
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleOnSubmit = (evt) => {
|
|
|
|
|
evt.preventDefault();
|
|
|
|
|
|
2025-05-02 15:07:05 -07:00
|
|
|
const { assignmentID, password } = state;
|
2025-04-16 12:02:42 -07:00
|
|
|
alert(
|
2025-05-02 15:07:05 -07:00
|
|
|
`You are signed in with assignmentID: ${assignmentID} and password: ${password}`
|
2025-04-16 12:02:42 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
for (const key in state) {
|
|
|
|
|
setState({
|
|
|
|
|
...state,
|
|
|
|
|
[key]: "",
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-04-21 18:32:13 -07:00
|
|
|
const googleAuth = () => {
|
2025-05-02 17:20:38 -07:00
|
|
|
window.open(`${authUrl}/auth/google`, "_self");
|
2025-04-21 18:32:13 -07:00
|
|
|
};
|
|
|
|
|
|
2025-04-16 12:02:42 -07:00
|
|
|
return (
|
|
|
|
|
<div className="form-container sign-up-container">
|
|
|
|
|
<form onSubmit={handleOnSubmit}>
|
2025-04-20 17:15:31 -07:00
|
|
|
<h1>Instructor</h1>
|
2025-04-16 12:02:42 -07:00
|
|
|
<div className="social-container">
|
2025-04-21 18:32:13 -07:00
|
|
|
<a href="#" className="social" onClick={googleAuth}>
|
2025-04-16 12:02:42 -07:00
|
|
|
<i className="fab fa-google-plus-g" />
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<span>or use your email for registration</span>
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
name="name"
|
|
|
|
|
value={state.name}
|
|
|
|
|
onChange={handleChange}
|
|
|
|
|
placeholder="Name"
|
|
|
|
|
/>
|
|
|
|
|
<input
|
|
|
|
|
type="email"
|
|
|
|
|
name="email"
|
|
|
|
|
value={state.email}
|
|
|
|
|
onChange={handleChange}
|
|
|
|
|
placeholder="Email"
|
|
|
|
|
/>
|
|
|
|
|
<input
|
|
|
|
|
type="password"
|
|
|
|
|
name="password"
|
|
|
|
|
value={state.password}
|
|
|
|
|
onChange={handleChange}
|
|
|
|
|
placeholder="Password"
|
|
|
|
|
/>
|
2025-04-20 17:15:31 -07:00
|
|
|
<button>Sign in</button>
|
2025-04-16 12:02:42 -07:00
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default SignUpForm;
|