Skip to content

feat(auth): add Firebase email/password login/signup flow while keeping Google sign-in#126

Open
PanditG4303 wants to merge 3 commits intoruxailab:mainfrom
PanditG4303:feat/email-auth-signup-fix-66
Open

feat(auth): add Firebase email/password login/signup flow while keeping Google sign-in#126
PanditG4303 wants to merge 3 commits intoruxailab:mainfrom
PanditG4303:feat/email-auth-signup-fix-66

Conversation

@PanditG4303
Copy link
Copy Markdown

@PanditG4303 PanditG4303 commented Mar 28, 2026

Screenshot 2026-03-28 214743 ## Summary This PR adds a dedicated authentication flow with email/password login and signup while preserving the existing Google sign-in experience.

Closes #66

Changes

  • Added new auth page with login/signup toggle at /auth
  • Added email/password auth actions using Firebase Authentication
  • Kept Google popup sign-in intact on the same screen
  • Added validation for empty fields and password length (>= 6)
  • Added loading state and Firebase error messaging in the UI
  • Added route guard behavior to redirect unauthenticated users from / to /auth
  • Updated login entry points in toolbar components to route to /auth

Files Changed

  • src/views/Auth.vue
  • src/services/firebaseAuth.js
  • src/router/index.js
  • src/components/general/InvisibleToolbar.vue
  • src/components/general/Toolbar.vue

Local Verification

  • npm run lint (passed)
  • npm run serve (app compiles and runs)
  • Verified login/signup toggle and validation behavior in UI
  • Verified auth integration wiring in code paths for signup, login, and Google sign-in

Notes

Firebase credentials were unavailable locally, so full end-to-end authentication against a live Firebase project could not be completed. This PR verifies UI behavior and auth logic integration within the app.

Suggested Screenshots

Please attach:

  1. /auth in Login mode
  2. /auth in Signup mode
  3. Validation/error state
  4. Loading state on submit

##Screenshot of Login page
Screenshot 2026-03-28 214743

Copilot AI review requested due to automatic review settings March 28, 2026 16:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new /auth screen to support Firebase email/password login & signup while preserving Google popup sign-in, and wires basic routing changes to steer users into the new flow.

Changes:

  • Added Auth.vue view with login/signup toggle, validation, loading state, and error messaging.
  • Added firebaseAuth.js service wrapping Firebase Auth (email/password + Google) and basic user profile persistence to Firestore.
  • Updated router and toolbar entry points to route users to /auth.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/views/Auth.vue New combined login/signup UI and Google sign-in entry point
src/services/firebaseAuth.js New Firebase auth + Firestore user-profile helper functions
src/router/index.js Adds /auth route and a navigation guard based on Firebase auth state
src/components/general/InvisibleToolbar.vue Updates login button route to /auth
src/components/general/Toolbar.vue Updates route-name check to align with new Auth route

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +71 to +75
router.beforeEach(async (to, from, next) => {
if (to.path !== '/' && to.path !== '/auth') {
next()
return
}
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The navigation guard only runs for '/' and '/auth'. This means unauthenticated users can still directly access '/dashboard' (and other app routes) by entering the URL. Consider marking protected routes (e.g., /dashboard, /calibration/*) with meta.requiresAuth and enforcing auth in the guard, and decide whether '/' (LandingPage) should remain public or be turned into a redirect route instead of being blocked here.

Copilot uses AI. Check for mistakes.
Comment on lines +52 to +58
export const signInWithGoogle = async () => {
const provider = new firebase.auth.GoogleAuthProvider()
const result = await firebase.auth().signInWithPopup(provider)
const user = result.user

await saveUserProfile(user)

Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

signInWithGoogle() awaits saveUserProfile(user). If the Firestore write fails (e.g., missing permissions), this will reject the whole sign-in flow even though the Firebase auth sign-in succeeded. Consider catching/logging profile-save errors and still returning the authenticated user, unless blocking is an explicit requirement.

Copilot uses AI. Check for mistakes.
Comment on lines +107 to +116
validateForm() {
if (!this.email || !this.password) {
this.errorMessage = 'Please enter both email and password.'
return false
}

if (this.password.length < 6) {
this.errorMessage = 'Password must be at least 6 characters long.'
return false
}
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validateForm() checks this.email directly, so whitespace-only input (e.g., ' ') passes validation but then trim() produces an empty email that will fail later with a Firebase error. Trim (and ideally normalize) the email during validation and validate against the trimmed value.

Copilot uses AI. Check for mistakes.
Comment on lines +28 to +37
<v-text-field
id="auth-password"
v-model="password"
label="Password"
type="password"
autocomplete="current-password"
outlined
dense
:disabled="loading"
@keyup.enter="submitAuth"
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The password field always uses autocomplete="current-password". In signup mode this should be new-password to avoid browser autofill issues and to better match password-manager expectations. Consider binding autocomplete based on isSignup.

Copilot uses AI. Check for mistakes.
Comment on lines 7 to 9
<v-btn text dark to="/" v-if="$route.name != 'Dashboard'">
{{ $route.name != 'Login' ? 'Calibration' : 'Home' }}
{{ $route.name != 'Auth' ? 'Calibration' : 'Home' }}
</v-btn>
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the Auth route this button label changes to 'Home' but it still links to '/'. With the new guard redirecting unauthenticated '/' -> '/auth', clicking it from /auth will just navigate back to /auth (no-op). Either keep '/' publicly accessible, or change this button's target/visibility so it leads somewhere meaningful from /auth.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing Login and Signup options( only google login is present)

2 participants