Skip to content

Implement simple authentication system with hardcoded credentials#11

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-10
Draft

Implement simple authentication system with hardcoded credentials#11
Copilot wants to merge 3 commits intomainfrom
copilot/fix-10

Conversation

Copy link
Contributor

Copilot AI commented Sep 23, 2025

This PR implements a complete authentication system for DigiHero with the specified dummy credentials:

  • Username: 101
  • Password: password
  • User Name: Manas Malla

Implementation Overview

The authentication system integrates seamlessly with the existing app architecture using the Provider pattern and Hive storage. The implementation includes:

Core Components

AuthService - A new service that handles authentication logic with hardcoded credential validation. It manages user state, provides login/logout functionality, and persists authentication status using the existing Hive storage infrastructure.

User Model - A simple data model representing authenticated users with JSON serialization for persistent storage and immutable design following Flutter best practices.

LoginScreen - A beautiful animated login interface that matches DigiHero's existing design language, featuring form validation, error handling, password visibility toggle, and smooth navigation integration.

App Flow Integration

The authentication flow has been integrated into the existing app navigation:

  1. SplashScreen now checks authentication status first
  2. Unauthenticated users are directed to the LoginScreen
  3. Authenticated users continue to AgeInputScreen (if needed) or GameHomeScreen
  4. User identity is displayed in the game home header as "Welcome back, Manas Malla!"
  5. Logout functionality is available in the settings menu with confirmation dialog

Key Features

  • Persistent Authentication - Login state survives app restarts using Hive storage
  • Credential Validation - Accepts only username "101" with password "password"
  • User Experience - Smooth animations, clear error messages, and intuitive navigation
  • Security - Proper logout with complete data clearing and confirmation
  • Integration - Minimal changes to existing codebase while adding comprehensive functionality

Testing

The implementation includes comprehensive unit tests covering authentication flows, user model serialization, and edge cases. The system properly handles invalid credentials with user-friendly error messages.

The authentication system is now ready for use with the specified credentials, providing a foundation for future authentication enhancements while maintaining the app's educational focus and user-friendly design.

Fixes #10.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits September 23, 2025 04:30
…d for user Manas Malla

Co-authored-by: ManasMalla <38750492+ManasMalla@users.noreply.github.com>
Co-authored-by: ManasMalla <38750492+ManasMalla@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement a simple authentication system Implement simple authentication system with hardcoded credentials Sep 23, 2025
Copilot AI requested a review from ManasMalla September 23, 2025 04:31
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.

Implement a simple authentication system

2 participants