Skip to content

Commit

Permalink
Add test for forgottenPass parameter, fix deeplink autoenable, fix RE…
Browse files Browse the repository at this point in the history
…ADMEs
  • Loading branch information
GoranPrime committed Feb 14, 2025
1 parent 7745420 commit 704b0f9
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 8 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ class GeneratorArgumentsProvider {
final projectConfiguration = _readProjectConfiguration();
final authConfiguration = _readAuthConfiguration();
final featureConfiguration = _readFeatureConfiguration(authConfiguration);
final showcaseConfiguration = _readShowcaseConfiguration(authConfiguration);
final showcaseConfiguration = _readShowcaseConfiguration(
authConfiguration,
featureConfiguration,
);
return GeneratorArguments(
outputDirectory: _outputDirectory,
projectConfiguration: projectConfiguration,
Expand Down Expand Up @@ -212,15 +215,16 @@ class GeneratorArgumentsProvider {
/// region Showcase Configuration
ShowcaseConfiguration _readShowcaseConfiguration(
AuthConfiguration authConfiguration) {
AuthConfiguration authConfiguration,
FeatureConfiguration featureConfiguration,
) {
// Counter
final counterEnabled = _reader.read<bool>(CreateCommandArguments.counter);

// Deep links
var deepLinkEnabled = _reader.read<bool>(CreateCommandArguments.deepLink);
// Onboarding/Registration
final onboardingEnabled =
_reader.read<bool>(CreateCommandArguments.onboarding);
final onboardingEnabled = featureConfiguration.onboardingEnabled;
if (onboardingEnabled && !deepLinkEnabled) {
_logger.warn('Deep links enabled, due to Onboarding feature requirement');
deepLinkEnabled = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
# feature_password_reset

[![Powered by Mason](https://img.shields.io/endpoint?url=https%3A%2F%2Ftinyurl.com%2Fmason-badge)](https://github.com/felangel/mason)
[![Powered by Mason](https://img.shields.io/endpoint?url=https%3A%2F%2Ftinyurl.com%2Fmason-badge)](https://github.com/felangel/mason)

A brick designed to bootstrap the integration of a robust Onboarding/Registration flow into your application. This feature enables users to register using their email, password, and phone number, with intuitive confirmation pages for each step. Users can also resume the process at any time during the confirmation steps.
A brick designed to bootstrap the integration of a robust Password Reset flow into your application. This feature enables users to reset their password using their email, with intuitive confirmation pages for each step.

<img src="https://raw.githubusercontent.com/Prime-Holding/rx_bloc/refs/heads/develop/packages/rx_bloc_cli/doc/assets/images/password_reset_request.png" alt="Feature Password Reset Request" width="200">
<img src="https://raw.githubusercontent.com/Prime-Holding/rx_bloc/refs/heads/develop/packages/rx_bloc_cli/doc/assets/images/password_reset_confirmation.png" alt="Feature Password Reset Email Confirmation" width="200">
<img src="https://raw.githubusercontent.com/Prime-Holding/rx_bloc/refs/heads/develop/packages/rx_bloc_cli/doc/assets/images/password_reset.png" alt="Feature Password Reset" width="200">
<img src="https://raw.githubusercontent.com/Prime-Holding/rx_bloc/refs/heads/develop/packages/rx_bloc_cli/doc/assets/images/password_reset_success.png" alt="Feature Password Reset Success" width="200">

## Features

- **Password Reset Request**: Allows users to request a password reset using their email.
- **Email Confirmation**: Lets the user open their email client & resend a new link. (contains mock links to be used for testing)
- **Password Change**: Allows users to change their password after opening the link.

## Authentication

This feature includes basic input validation and authentication infrastructure related to the onboarding process. Users can log in using their email and password as credentials.
This feature includes basic input validation and authentication infrastructure related to the password reset process. Users can reset their password using their email as credentials.

## Important Note

This brick is a bootstrap tool meant to make kickstarting a password reset flow faster. It includes only a basic example backend and does not actually send confirmation emails. It is expected that a "real" backend would handle these tasks in the future.

## API Contracts

For detailed API contracts and to better understand the flow, please refer to the [API Contracts](__brick__/docs/onboarding_api_contracts.md) document.
For detailed API contracts and to better understand the flow, please refer to the [API Contracts](__brick__/docs/forgotten_pass_api_contracts.md) document.
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,20 @@ void main() {

verify(logger.warn(any)).called(3);
});

test('should return updated values if forgotten pass is enabled', () {
configureArgumentValues(Stub.forgottenPassEnabled);

verifyNever(logger.warn(any));
final generatorArguments = sut.readGeneratorArguments();

expect(generatorArguments.profileEnabled, isTrue);
expect(generatorArguments.loginEnabled, isTrue);
expect(generatorArguments.deepLinkEnabled, isTrue);
expect(generatorArguments.onboardingEnabled, isTrue);
expect(generatorArguments.forgottenPassword, isTrue);

verify(logger.warn(any)).called(4);
});
});
}
8 changes: 8 additions & 0 deletions packages/rx_bloc_cli/test/stub.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ final class Stub {
..[CreateCommandArguments.login.name] = false
..[CreateCommandArguments.profile.name] = false;

static Map<String, Object> get forgottenPassEnabled =>
Map.from(Stub.defaultValues)
..[CreateCommandArguments.forgottenPassword.name] = true
..[CreateCommandArguments.onboarding.name] = false
..[CreateCommandArguments.deepLink.name] = false
..[CreateCommandArguments.login.name] = false
..[CreateCommandArguments.profile.name] = false;

static final generatorArgumentsAllEnabled = GeneratorArguments(
outputDirectory: Directory('some/output_directory'),
projectConfiguration: ProjectConfiguration(
Expand Down

0 comments on commit 704b0f9

Please sign in to comment.