Skip to content

Commit

Permalink
Merge pull request #20 from yale-swe/code_review_snapshot
Browse files Browse the repository at this point in the history
login and registration
  • Loading branch information
sophiayk20 committed Dec 2, 2023
2 parents 4b33a17 + aee5f71 commit 46b5c23
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 35 deletions.
2 changes: 1 addition & 1 deletion app/newHere1/newHere/Views/Login/LoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct LoginView: View {
.alert(isPresented: $showingAlert) {
Alert(title: Text("Login Status"), message: Text(alertMessage), dismissButton: .default(Text("OK")))
}
}
}.navigationBarBackButtonHidden(true)
}

/// Function to handle user login
Expand Down
70 changes: 36 additions & 34 deletions app/newHere1/newHere/Views/Registration/Registration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,44 +36,46 @@ struct RegistrationView: View {

var body: some View {
NavigationView {
Form {
// User name input section
Section(header: Text("Name")) {
TextField("First Name", text: $firstName)
.disableAutocorrection(true)
TextField("Last Name", text: $lastName)
.disableAutocorrection(true)
}

// User credentials input section
Section(header: Text("Credentials")) {
TextField("Username", text: $userName)
.disableAutocorrection(true)
TextField("Email", text: $email)
.keyboardType(.emailAddress)
.disableAutocorrection(true)
SecureField("Password", text: $password)
.disableAutocorrection(true)
SecureField("Confirm Password", text: $confirmPassword)
.disableAutocorrection(true)
}

// Submit button and navigation to login view
Section {
Button(action: registerUser) {
Text("Submit")
VStack{
Form {
// User name input section
Section(header: Text("Name")) {
TextField("First Name", text: $firstName)
.disableAutocorrection(true)
TextField("Last Name", text: $lastName)
.disableAutocorrection(true)
}

// User credentials input section
Section(header: Text("Credentials")) {
TextField("Username", text: $userName)
.disableAutocorrection(true)
TextField("Email", text: $email)
.keyboardType(.emailAddress)
.disableAutocorrection(true)
SecureField("Password", text: $password)
.disableAutocorrection(true)
SecureField("Confirm Password", text: $confirmPassword)
.disableAutocorrection(true)
}

NavigationLink(destination: LoginView(isAuthenticated: $isAuthenticated)) {
Text("Already have an account? Login")

// Submit button and navigation to login view
Section {
Button(action: registerUser) {
Text("Submit")
}

NavigationLink(destination: LoginView(isAuthenticated: $isAuthenticated)) {
Text("Already have an account? Login")
}
}
}
//.navigationBarTitle("Registration")
.alert(isPresented: $showingAlert){
Alert(title: Text("Registration Status"), message: Text(alertMessage), dismissButton: .default(Text("OK")))
}
}
.navigationBarTitle("Registration")
.alert(isPresented: $showingAlert){
Alert(title: Text("Registration Status"), message: Text(alertMessage), dismissButton: .default(Text("OK")))
}
}
}.navigationBarBackButtonHidden(true)
}

/// Function to handle user registration
Expand Down

0 comments on commit 46b5c23

Please sign in to comment.