Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vt-research-connect-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cscapstone-group3
vt-research-connect-frontend
Commits
72121078
Commit
72121078
authored
7 months ago
by
hannahl8
Browse files
Options
Downloads
Patches
Plain Diff
update sign up page for professors
parent
f4b10d87
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#10812
passed
7 months ago
Stage: build
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/pages/SignUpProfessorPage.tsx
+46
-25
46 additions, 25 deletions
src/pages/SignUpProfessorPage.tsx
src/types.ts
+1
-1
1 addition, 1 deletion
src/types.ts
with
47 additions
and
26 deletions
src/pages/SignUpProfessorPage.tsx
+
46
−
25
View file @
72121078
...
...
@@ -20,8 +20,8 @@ interface FormValues {
password
:
string
;
confirmPassword
:
string
;
collegeId
:
number
;
majorId
:
number
;
addLab
:
boolean
;
majorId
:
number
;
labName
:
string
;
labUrl
:
string
;
labDescription
:
string
;
...
...
@@ -34,8 +34,8 @@ const initialValues: FormValues = {
password
:
''
,
confirmPassword
:
''
,
collegeId
:
1
,
majorId
:
1
,
addLab
:
false
,
majorId
:
1
,
labName
:
''
,
labUrl
:
''
,
labDescription
:
''
...
...
@@ -55,8 +55,7 @@ const validationSchema = object({
confirmPassword
:
string
()
.
oneOf
([
ref
(
'
password
'
)],
'
Passwords must match.
'
)
.
required
(
'
Confirm password is required.
'
),
collegeId
:
number
().
required
(
'
College is required
'
),
majorId
:
number
().
required
(
'
Major is required
'
)
collegeId
:
number
().
required
(
'
College is required
'
)
});
export
default
function
SignUpProfessorPage
()
{
...
...
@@ -80,27 +79,49 @@ export default function SignUpProfessorPage() {
actions
.
setSubmitting
(
false
);
}
else
{
setSignupStatus
(
"
PENDING
"
);
const
signUpResponse
:
SignUpResponse
=
await
signUp
({
username
:
values
.
email
,
password
:
values
.
password
,
role
:
"
PROFESSOR
"
,
firstName
:
values
.
firstName
,
lastName
:
values
.
lastName
,
email
:
values
.
email
,
collegeId
:
values
.
collegeId
,
majorId
:
values
.
majorId
,
labName
:
values
.
labName
,
labUrl
:
values
.
labUrl
,
labDescription
:
values
.
labDescription
});
if
(
!
signUpResponse
.
success
)
{
setSignupStatus
(
"
SERVER_ERROR
"
);
setServerErrorMessage
(
signUpResponse
.
message
);
let
signUpResponse
:
SignUpResponse
;
if
(
values
.
addLab
)
{
signUpResponse
=
await
signUp
({
username
:
values
.
email
,
password
:
values
.
password
,
role
:
"
PROFESSOR
"
,
firstName
:
values
.
firstName
,
lastName
:
values
.
lastName
,
email
:
values
.
email
,
collegeId
:
values
.
collegeId
,
majorId
:
values
.
majorId
,
labName
:
values
.
labName
,
labUrl
:
values
.
labUrl
,
labDescription
:
values
.
labDescription
});
if
(
!
signUpResponse
.
success
)
{
setSignupStatus
(
"
SERVER_ERROR
"
);
setServerErrorMessage
(
signUpResponse
.
message
);
}
else
{
setSignupStatus
(
"
OK
"
);
await
sleep
(
1000
);
navigate
(
`
${
signupConfirmationPagePath
}
`
);
}
}
else
{
setSignupStatus
(
"
OK
"
);
await
sleep
(
1000
);
navigate
(
`
${
signupConfirmationPagePath
}
`
);
signUpResponse
=
await
signUp
({
username
:
values
.
email
,
password
:
values
.
password
,
role
:
"
PROFESSOR
"
,
firstName
:
values
.
firstName
,
lastName
:
values
.
lastName
,
email
:
values
.
email
,
collegeId
:
values
.
collegeId
});
if
(
!
signUpResponse
.
success
)
{
setSignupStatus
(
"
SERVER_ERROR
"
);
setServerErrorMessage
(
signUpResponse
.
message
);
}
else
{
setSignupStatus
(
"
OK
"
);
await
sleep
(
1000
);
navigate
(
`
${
signupConfirmationPagePath
}
`
);
}
}
}
};
...
...
@@ -125,12 +146,12 @@ export default function SignUpProfessorPage() {
<
TextInput
label
=
"Confirm Password"
name
=
"confirmPassword"
type
=
"password"
/>
<
SelectInput
label
=
"College:"
name
=
"collegeId"
options
=
{
colleges
}
></
SelectInput
>
<
SelectInput
label
=
"Major:"
name
=
"majorId"
options
=
{
majors
}
></
SelectInput
>
<
CheckboxInput
label
=
"Add Research Lab?"
id
=
"addLab"
name
=
"addLab"
/>
{
values
.
addLab
&&
(
<>
<
SelectInput
label
=
"Major:"
name
=
"majorId"
options
=
{
majors
}
></
SelectInput
>
<
TextInput
label
=
"Research Lab Name"
name
=
"labName"
/>
<
TextInput
label
=
"Research Lab Website URL"
name
=
"labUrl"
type
=
"url"
/>
<
TextInput
label
=
"Research Lab Description"
name
=
"labDescription"
type
=
"textarea"
/>
...
...
This diff is collapsed.
Click to expand it.
src/types.ts
+
1
−
1
View file @
72121078
...
...
@@ -89,7 +89,7 @@ export interface SignupForm {
lastName
:
string
,
email
:
string
,
year
?:
string
,
// Student
majorId
:
number
,
majorId
?
:
number
,
// Student
aboutMe
?:
string
,
// Student
collegeId
?:
number
,
// Professor
labName
?:
string
,
// Professor
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment