diff --git a/packages/rx_bloc_cli/CHANGELOG.md b/packages/rx_bloc_cli/CHANGELOG.md index dc9e81466..4653fc958 100644 --- a/packages/rx_bloc_cli/CHANGELOG.md +++ b/packages/rx_bloc_cli/CHANGELOG.md @@ -1,9 +1,7 @@ -## [5.6.0] -* Added Forgotten password feature in the generated project - ## [5.5.0] * Added change email feature in the generated project * Added change phone number feature in the generated project +* Added Forgotten password feature in the generated project ## [5.4.1] * Fix static analysis issue with multiline if statement brackets after linter update diff --git a/packages/rx_bloc_cli/bin/compile_test_project.sh b/packages/rx_bloc_cli/bin/compile_test_project.sh index b64f7edba..76b7b0c55 100755 --- a/packages/rx_bloc_cli/bin/compile_test_project.sh +++ b/packages/rx_bloc_cli/bin/compile_test_project.sh @@ -12,7 +12,7 @@ function replace_file_contents() { "docs/patrol_integration_test.md" "https://github.com/Prime-Holding/rx_bloc/blob/master/packages/rx_bloc_cli/example/docs/patrol_integration_test.md" "docs/feature_creation.md" "https://github.com/Prime-Holding/rx_bloc/blob/master/packages/rx_bloc_cli/example/docs/feature_creation.md" "docs/onboarding_api_contracts.md" "https://github.com/Prime-Holding/rx_bloc/blob/master/packages/rx_bloc_cli/example/docs/onboarding_api_contracts.md" - "docs/forgotten_pass_api_contracts.md" "https://github.com/Prime-Holding/rx_bloc/blob/master/packages/rx_bloc_cli/example/docs/forgotten_pass_api_contracts.md" + "docs/forgotten_password_api_contracts.md" "https://github.com/Prime-Holding/rx_bloc/blob/master/packages/rx_bloc_cli/example/docs/forgotten_password_api_contracts.md" ) # Iterate over the to_replace array diff --git a/packages/rx_bloc_cli/example/README.md b/packages/rx_bloc_cli/example/README.md index 39268606f..44446f5c7 100644 --- a/packages/rx_bloc_cli/example/README.md +++ b/packages/rx_bloc_cli/example/README.md @@ -563,7 +563,7 @@ The Forgotten password feature lets a registered user reset their password and s The flow includes screens which allow the user to provide their email and continue with a link to reset. When that link is opened, the user can set their new password. -For details on the API contracts used in the Forgotten password feature, please refer to the [API contracts][feature_forgotten_pass_api]. +For details on the API contracts used in the Forgotten password feature, please refer to the [API contracts][feature_forgotten_password_api]. ## Next Steps @@ -614,4 +614,4 @@ For details on the API contracts used in the Forgotten password feature, please [rx_bloc_cli_mfa_lnk]: https://github.com/Prime-Holding/rx_bloc/blob/master/packages/rx_bloc_cli/example/docs/mfa.md [feature_creation]: https://github.com/Prime-Holding/rx_bloc/blob/master/packages/rx_bloc_cli/example/docs/feature_creation.md [feature_onboarding_api]: https://github.com/Prime-Holding/rx_bloc/blob/master/packages/rx_bloc_cli/example/docs/onboarding_api_contracts.md -[feature_forgotten_pass_api]: https://github.com/Prime-Holding/rx_bloc/blob/master/packages/rx_bloc_cli/example/docs/forgotten_pass_api_contracts.md \ No newline at end of file +[feature_forgotten_password_api]: https://github.com/Prime-Holding/rx_bloc/blob/master/packages/rx_bloc_cli/example/docs/forgotten_password_api_contracts.md \ No newline at end of file diff --git a/packages/rx_bloc_cli/example/docs/forgotten_pass_api_contracts.md b/packages/rx_bloc_cli/example/docs/forgotten_password_api_contracts.md similarity index 100% rename from packages/rx_bloc_cli/example/docs/forgotten_pass_api_contracts.md rename to packages/rx_bloc_cli/example/docs/forgotten_password_api_contracts.md diff --git a/packages/rx_bloc_cli/lib/src/models/generator_arguments.dart b/packages/rx_bloc_cli/lib/src/models/generator_arguments.dart index e290ddade..5160988a2 100644 --- a/packages/rx_bloc_cli/lib/src/models/generator_arguments.dart +++ b/packages/rx_bloc_cli/lib/src/models/generator_arguments.dart @@ -116,7 +116,7 @@ class GeneratorArguments @override bool get onboardingEnabled => _featureConfiguration.onboardingEnabled; - /// Forgotten pass feature + /// Forgotten Password feature @override bool get forgottenPassword => _featureConfiguration.forgottenPassword; diff --git a/packages/rx_bloc_cli/lib/src/models/generator_arguments_provider.dart b/packages/rx_bloc_cli/lib/src/models/generator_arguments_provider.dart index ed45a4cd7..25290b976 100644 --- a/packages/rx_bloc_cli/lib/src/models/generator_arguments_provider.dart +++ b/packages/rx_bloc_cli/lib/src/models/generator_arguments_provider.dart @@ -112,7 +112,7 @@ class GeneratorArgumentsProvider { !(loginEnabled || socialLoginsEnabled)) { // Modify feature flag or throw exception _logger.warn( - 'Login enabled, due to OTP/PIN/Onboarding/Forgotten Pass feature requirement'); + 'Login enabled, due to OTP/PIN/Onboarding/Forgotten Password feature requirement'); loginEnabled = true; } diff --git a/packages/rx_bloc_cli/mason_templates/bricks/feature_onboarding/__brick__/bin/server/repositories/users_repository.dart b/packages/rx_bloc_cli/mason_templates/bricks/feature_onboarding/__brick__/bin/server/repositories/users_repository.dart index 5910ea944..7830a585f 100644 --- a/packages/rx_bloc_cli/mason_templates/bricks/feature_onboarding/__brick__/bin/server/repositories/users_repository.dart +++ b/packages/rx_bloc_cli/mason_templates/bricks/feature_onboarding/__brick__/bin/server/repositories/users_repository.dart @@ -6,6 +6,8 @@ import 'package:{{project_name}}/base/models/confirmed_credentials_model.dart'; import 'package:{{project_name}}/base/models/user_model.dart'; import 'package:{{project_name}}/base/models/user_role.dart'; +const kPasswordResetTimeoutInSeconds = 60; + class UsersRepository { final List _registeredUsers = []; final Map _passwords = {}; @@ -80,10 +82,10 @@ class UsersRepository { _passwordResetLockedUsers.keys.contains(email); int getPasswordResetTimeoutForUser(String email) => - _passwordResetLockedUsers[email] ?? 60; + _passwordResetLockedUsers[email] ?? kPasswordResetTimeoutInSeconds; void lockPasswordResetForUser(String email) => - _passwordResetLockedUsers[email] = 60; + _passwordResetLockedUsers[email] = kPasswordResetTimeoutInSeconds; void decrementPasswordResetTimeoutForUser(String email) => _passwordResetLockedUsers.update(email, (timeout) => --timeout); diff --git a/packages/rx_bloc_cli/mason_templates/bricks/feature_onboarding/__brick__/bin/server/services/users_service.dart b/packages/rx_bloc_cli/mason_templates/bricks/feature_onboarding/__brick__/bin/server/services/users_service.dart index 4e4ea6095..6bd6d344e 100644 --- a/packages/rx_bloc_cli/mason_templates/bricks/feature_onboarding/__brick__/bin/server/services/users_service.dart +++ b/packages/rx_bloc_cli/mason_templates/bricks/feature_onboarding/__brick__/bin/server/services/users_service.dart @@ -90,7 +90,7 @@ class UsersService { Timer.periodic( const Duration(seconds: 1), (timer) { - if (timer.tick == 60) { + if (timer.tick == kPasswordResetTimeoutInSeconds) { _usersRepository.unlockPasswordResetForUser(email); return timer.cancel(); } diff --git a/packages/rx_bloc_cli/mason_templates/bricks/feature_password_reset/__brick__/docs/forgotten_pass_api_contracts.md b/packages/rx_bloc_cli/mason_templates/bricks/feature_password_reset/__brick__/docs/forgotten_password_api_contracts.md similarity index 100% rename from packages/rx_bloc_cli/mason_templates/bricks/feature_password_reset/__brick__/docs/forgotten_pass_api_contracts.md rename to packages/rx_bloc_cli/mason_templates/bricks/feature_password_reset/__brick__/docs/forgotten_password_api_contracts.md diff --git a/packages/rx_bloc_cli/mason_templates/bricks/feature_password_reset/__brick__/lib/feature_password_reset/blocs/password_reset_bloc.dart b/packages/rx_bloc_cli/mason_templates/bricks/feature_password_reset/__brick__/lib/feature_password_reset/blocs/password_reset_bloc.dart index e29bc73b8..44479dad6 100644 --- a/packages/rx_bloc_cli/mason_templates/bricks/feature_password_reset/__brick__/lib/feature_password_reset/blocs/password_reset_bloc.dart +++ b/packages/rx_bloc_cli/mason_templates/bricks/feature_password_reset/__brick__/lib/feature_password_reset/blocs/password_reset_bloc.dart @@ -74,7 +74,9 @@ class PasswordResetBloc extends $PasswordResetBloc { final CredentialsValidatorService _validatorService; final RouterBlocType _routerBloc; + /// The token received from the Email link, to be checked by the backend final String _token; + /// The Email of the user, to be used in case of resending the link final String _email; @override diff --git a/packages/rx_bloc_cli/mason_templates/bricks/feature_password_reset/__brick__/lib/l10n/arb/feature_password_reset/bg.arb b/packages/rx_bloc_cli/mason_templates/bricks/feature_password_reset/__brick__/lib/l10n/arb/feature_password_reset/bg.arb index 6c58d4344..f87cce4a1 100644 --- a/packages/rx_bloc_cli/mason_templates/bricks/feature_password_reset/__brick__/lib/l10n/arb/feature_password_reset/bg.arb +++ b/packages/rx_bloc_cli/mason_templates/bricks/feature_password_reset/__brick__/lib/l10n/arb/feature_password_reset/bg.arb @@ -21,7 +21,6 @@ "tokenResent": "Нова връзка за нулиране на вашата парола е изпратена на вашия имейл адрес.", "resetSuccess": "Вашата парола е успешно нулирана!", - "retry" : "Опитай отново", "continueText" : "Продължи", "confirm" : "Потвърди" } \ No newline at end of file diff --git a/packages/rx_bloc_cli/mason_templates/bricks/feature_password_reset/__brick__/lib/l10n/arb/feature_password_reset/en.arb b/packages/rx_bloc_cli/mason_templates/bricks/feature_password_reset/__brick__/lib/l10n/arb/feature_password_reset/en.arb index cb87079da..1da0e55fc 100644 --- a/packages/rx_bloc_cli/mason_templates/bricks/feature_password_reset/__brick__/lib/l10n/arb/feature_password_reset/en.arb +++ b/packages/rx_bloc_cli/mason_templates/bricks/feature_password_reset/__brick__/lib/l10n/arb/feature_password_reset/en.arb @@ -21,7 +21,6 @@ "tokenResent": "A new link to reset your password has been sent to your email address.", "resetSuccess": "Your password has been successfully reset!", - "retry" : "Retry", "continueText" : "Continue", "confirm" : "Confirm" } \ No newline at end of file diff --git a/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/README.md b/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/README.md index 1f3790a18..d0eafeb46 100644 --- a/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/README.md +++ b/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/README.md @@ -563,7 +563,7 @@ The Forgotten password feature lets a registered user reset their password and s The flow includes screens which allow the user to provide their email and continue with a link to reset. When that link is opened, the user can set their new password. -For details on the API contracts used in the Forgotten password feature, please refer to the [API contracts][feature_forgotten_pass_api]. +For details on the API contracts used in the Forgotten password feature, please refer to the [API contracts][feature_forgotten_password_api]. {{/enable_forgotten_password}} ## Next Steps @@ -614,4 +614,4 @@ For details on the API contracts used in the Forgotten password feature, please [rx_bloc_cli_mfa_lnk]: docs/mfa.md [feature_creation]: docs/feature_creation.md [feature_onboarding_api]: docs/onboarding_api_contracts.md -[feature_forgotten_pass_api]: docs/forgotten_pass_api_contracts.md \ No newline at end of file +[feature_forgotten_password_api]: docs/forgotten_password_api_contracts.md \ No newline at end of file diff --git a/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/base/common_ui_components/app_error_modal_widget.dart b/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/base/common_ui_components/app_error_modal_widget.dart index a56c6b5d8..e1174852b 100644 --- a/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/base/common_ui_components/app_error_modal_widget.dart +++ b/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/base/common_ui_components/app_error_modal_widget.dart @@ -5,6 +5,7 @@ import 'package:flutter_rx_bloc/flutter_rx_bloc.dart'; import 'package:rx_bloc/rx_bloc.dart'; import 'package:widget_toolkit/widget_toolkit.dart' hide ErrorModel; +import '../../app_extensions.dart'; import '../extensions/error_model_translations.dart'; import '../models/errors/error_model.dart'; @@ -17,14 +18,14 @@ class AppErrorModalWidget required this.errorState, this.onRetry, this.onCancel, - this.retryButtonText = 'Retry', + this.retryButtonText, super.key, }); final ErrorStateCallback errorState; final Function(BuildContext, ErrorModel)? onRetry; final Function()? onCancel; - final String retryButtonText; + final String? retryButtonText; @override Widget build(BuildContext context) => RxBlocListener( @@ -42,7 +43,7 @@ class AppErrorModalWidget Navigator.of(context).pop(); }, onCancelCallback: onCancel, - retryButtonText: retryButtonText, + retryButtonText: retryButtonText ?? context.l10n.retry, ) : showBlurredBottomSheet( context: context, diff --git a/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/l10n/arb/bg.arb b/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/l10n/arb/bg.arb index 0b59a60f2..c16fee52a 100644 --- a/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/l10n/arb/bg.arb +++ b/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/l10n/arb/bg.arb @@ -9,6 +9,7 @@ "resetPassword": "Нулиране на парола", "pageWithResult": "Въведете съобщение", "tryAgain" : "Опитайте отново", + "retry" : "Опитай отново", "confirm" : "Потвърдете", "submit" : "Изпращане", "continueText": "Продължи", diff --git a/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/l10n/arb/en.arb b/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/l10n/arb/en.arb index a612c760d..e2aef0f9c 100644 --- a/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/l10n/arb/en.arb +++ b/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/l10n/arb/en.arb @@ -9,6 +9,7 @@ "resetPassword" : "Reset password", "pageWithResult" : "Enter message", "tryAgain" : "Try again", + "retry" : "Retry", "confirm" : "Confirm", "submit" : "Submit", "continueText": "Continue",