Skip to content
5 changes: 3 additions & 2 deletions server/routes/user.router.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ router.post("/register", (req, res, next) => {
const username = req.body.username;
const password = encryptLib.encryptPassword(req.body.password);

const queryText = `INSERT INTO "user" (username, password, first_name, last_name, date_of_birth, city, state, access_level)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING id`;
const queryText = `INSERT INTO "user" (username, password, first_name, last_name, date_of_birth, city, state, email, access_level)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING id`;
pool
.query(queryText, [
username,
Expand All @@ -32,6 +32,7 @@ router.post("/register", (req, res, next) => {
req.body.dateOfBirth,
req.body.city,
req.body.state,
req.body.email,
req.body.accessLevel,
])
.then(() => res.sendStatus(201))
Expand Down
20 changes: 20 additions & 0 deletions src/components/RegisterForm/RegisterForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function RegisterForm() {
const [dateOfBirth, setDateOfBirth] = useState("");
const [city, setCity] = useState("");
const [state, setState] = useState("");
const [email, setEmail] = useState("");
const [username, setUsername] = useState("");
const [password, setPassword] = useState("");
const [accessLevel, setAccessLevel] = useState("");
Expand All @@ -30,6 +31,7 @@ function RegisterForm() {
dateOfBirth: dateOfBirth,
city: city,
state: state,
email: email,
username: username,
password: password,
accessLevel: accessLevel,
Expand Down Expand Up @@ -153,6 +155,24 @@ function RegisterForm() {
label="Email"
variant="outlined"
type="text"
name="email"
value={email}
required
onChange={(event) => setEmail(event.target.value)}
/>
</div>
<div style={{ marginBottom: "10px" }}>
<TextField
InputProps={{
style: {
borderRadius: "40px",
width: "250px",
backgroundColor: "white",
}
}}
label="Username"
variant="outlined"
type="text"
name="username"
value={username}
required
Expand Down