Skip to content

Commit 46b5c23

Browse files
authored
Merge pull request #20 from yale-swe/code_review_snapshot
login and registration
2 parents 4b33a17 + aee5f71 commit 46b5c23

File tree

2 files changed

+37
-35
lines changed

2 files changed

+37
-35
lines changed

app/newHere1/newHere/Views/Login/LoginView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ struct LoginView: View {
8989
.alert(isPresented: $showingAlert) {
9090
Alert(title: Text("Login Status"), message: Text(alertMessage), dismissButton: .default(Text("OK")))
9191
}
92-
}
92+
}.navigationBarBackButtonHidden(true)
9393
}
9494

9595
/// Function to handle user login

app/newHere1/newHere/Views/Registration/Registration.swift

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -36,44 +36,46 @@ struct RegistrationView: View {
3636

3737
var body: some View {
3838
NavigationView {
39-
Form {
40-
// User name input section
41-
Section(header: Text("Name")) {
42-
TextField("First Name", text: $firstName)
43-
.disableAutocorrection(true)
44-
TextField("Last Name", text: $lastName)
45-
.disableAutocorrection(true)
46-
}
47-
48-
// User credentials input section
49-
Section(header: Text("Credentials")) {
50-
TextField("Username", text: $userName)
51-
.disableAutocorrection(true)
52-
TextField("Email", text: $email)
53-
.keyboardType(.emailAddress)
54-
.disableAutocorrection(true)
55-
SecureField("Password", text: $password)
56-
.disableAutocorrection(true)
57-
SecureField("Confirm Password", text: $confirmPassword)
58-
.disableAutocorrection(true)
59-
}
60-
61-
// Submit button and navigation to login view
62-
Section {
63-
Button(action: registerUser) {
64-
Text("Submit")
39+
VStack{
40+
Form {
41+
// User name input section
42+
Section(header: Text("Name")) {
43+
TextField("First Name", text: $firstName)
44+
.disableAutocorrection(true)
45+
TextField("Last Name", text: $lastName)
46+
.disableAutocorrection(true)
47+
}
48+
49+
// User credentials input section
50+
Section(header: Text("Credentials")) {
51+
TextField("Username", text: $userName)
52+
.disableAutocorrection(true)
53+
TextField("Email", text: $email)
54+
.keyboardType(.emailAddress)
55+
.disableAutocorrection(true)
56+
SecureField("Password", text: $password)
57+
.disableAutocorrection(true)
58+
SecureField("Confirm Password", text: $confirmPassword)
59+
.disableAutocorrection(true)
6560
}
66-
67-
NavigationLink(destination: LoginView(isAuthenticated: $isAuthenticated)) {
68-
Text("Already have an account? Login")
61+
62+
// Submit button and navigation to login view
63+
Section {
64+
Button(action: registerUser) {
65+
Text("Submit")
66+
}
67+
68+
NavigationLink(destination: LoginView(isAuthenticated: $isAuthenticated)) {
69+
Text("Already have an account? Login")
70+
}
6971
}
7072
}
73+
//.navigationBarTitle("Registration")
74+
.alert(isPresented: $showingAlert){
75+
Alert(title: Text("Registration Status"), message: Text(alertMessage), dismissButton: .default(Text("OK")))
76+
}
7177
}
72-
.navigationBarTitle("Registration")
73-
.alert(isPresented: $showingAlert){
74-
Alert(title: Text("Registration Status"), message: Text(alertMessage), dismissButton: .default(Text("OK")))
75-
}
76-
}
78+
}.navigationBarBackButtonHidden(true)
7779
}
7880

7981
/// Function to handle user registration

0 commit comments

Comments
 (0)