From aee5f717fb8f827d797d42a126449d2434d5a4b8 Mon Sep 17 00:00:00 2001 From: syk2021 Date: Sat, 2 Dec 2023 17:50:52 -0500 Subject: [PATCH] login and registration --- .../newHere/Views/Login/LoginView.swift | 2 +- .../Views/Registration/Registration.swift | 70 ++++++++++--------- 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/app/newHere1/newHere/Views/Login/LoginView.swift b/app/newHere1/newHere/Views/Login/LoginView.swift index e565c12..ff81007 100644 --- a/app/newHere1/newHere/Views/Login/LoginView.swift +++ b/app/newHere1/newHere/Views/Login/LoginView.swift @@ -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 diff --git a/app/newHere1/newHere/Views/Registration/Registration.swift b/app/newHere1/newHere/Views/Registration/Registration.swift index 263deb6..33b4fe4 100644 --- a/app/newHere1/newHere/Views/Registration/Registration.swift +++ b/app/newHere1/newHere/Views/Registration/Registration.swift @@ -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