Skip to content

Enhance auth feature #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jul 28, 2025
Merged

Enhance auth feature #34

merged 15 commits into from
Jul 28, 2025

Conversation

fulleni
Copy link
Member

@fulleni fulleni commented Jul 28, 2025

Status

READY/IN DEVELOPMENT/HOLD

Description

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

fulleni added 15 commits July 28, 2025 17:42
- Add pinput package to pubspec.yaml for improved text input handling
- Update pubspec.lock with new dependencies:
  - pinput: ^5.0.1
  - universal_platform: ^1.1.0 (transitive dependency)
- Ensure proper formatting and version management for all packages
- Modified the appEnvironment constant in main.dart
- Changed value from AppEnvironment.demo to AppEnvironment.development
…ime prop

- Add requestCodeCooldown status to AuthenticationStatus enum
- Add cooldownEndTime property to AuthenticationState
- Update props list in AuthenticationState to include cooldownEndTime
- Modify copyWith method to include cooldownEndTime parameter
Add a new event to the authentication bloc to handle the completion of the sign-in code request cooldown.
- Add cooldown functionality to prevent frequent code requests
- Introduce new AuthenticationStatus.state: requestCodeCooldown
- Implement timer to transition out of cooldown after 60 seconds
- Update UI feedback during cooldown period
- Implement cooldown timer functionality in EmailLinkForm
- Add state management for cooldown seconds and timer
- Update UI to reflect cooldown state
- Integrate cooldown logic with AuthenticationBloc
- Import dart:async library in request_code_page.dart
- Prepare for potential future implementations that may require Timer or Future functionalities
- Add new localization strings for both Arabic and English
- Implement placeholder for seconds in cooldown period
- Update existing localization files for both languages
…e verification

- Add pinput package for improved pin input experience
- Implement Pinput with custom PinTheme
- Update form validation and submission logic
- Adjust UI to match new input style
- Remove unused import statement for 'package:flutter/services.dart'
- This change simplifies the code and reduces potential confusion for developers
- Add @@Locale metadata to app_ar.arb and app_en.arb files
- This information is used by Flutter to identify the locale of each ARB file
- Add clearCooldownEndTime parameter to copyWith method
- Set cooldownEndTime to null when clearCooldownEndTime is true
- Update AuthenticationBloc to include clearCooldownEndTime flag when resetting status to initial
- This change ensures proper reset of cooldown state and prevents potential issues with leftover values
- Update cooldown timer condition to ensure it only starts when cooldownEndTime is in the future
- Remove redundant status check for better readability
Refactored the authentication BLoC and UI to rely solely on the `cooldownEndTime` timestamp for managing the sign-in code request cooldown. This removes the redundant `requestCodeCooldown` from the `AuthenticationStatus` enum, simplifying the state machine and establishing a single source of truth for the cooldown logic.

This change fixes the bug where the cooldown timer would not display correctly after a failed verification and makes the implementation more robust and maintainable.
@fulleni fulleni merged commit 16024dd into main Jul 28, 2025
1 check failed
@fulleni fulleni deleted the enhance_auth_feature branch July 28, 2025 17:40
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @fulleni, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the authentication feature by introducing a robust cooldown mechanism for sign-in code requests, improving both security and user experience. It also refactors the code verification input field to utilize a specialized Pinput widget, offering a more intuitive and visually polished way for users to enter their authentication codes. The changes include necessary state management updates and UI synchronization to support these new features.

Highlights

  • Authentication Cooldown: Implemented a 60-second cooldown mechanism for requesting sign-in codes to prevent abuse. The system now tracks the cooldown period and prevents new requests until it expires.
  • Enhanced Code Entry UI: Replaced the standard text input for verification codes with the Pinput widget, providing a more visually appealing and user-friendly experience for entering multi-digit codes.
  • Dynamic UI Feedback: The 'Send Code' button now dynamically displays a countdown during the cooldown period and is disabled, providing clear feedback to the user on when they can resend a code. This includes localization support for the countdown message.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the authentication flow by introducing a cooldown period for requesting sign-in codes, preventing users from spamming requests. The UI has been improved by replacing the standard text field for code entry with the pinput package for a better user experience, and the request code page now displays a countdown timer. The implementation is solid, but I've identified two high-severity issues: 1. A potential memory leak and runtime error in AuthenticationBloc due to an uncancelled Timer. 2. Redundant logic in the UI layer (request_code_page.dart) that duplicates state management already handled by the BLoC. Addressing these points will improve the robustness and maintainability of the new feature.

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.

1 participant