Breaking changes:
- Updated ArcaneAuthInterface to make the `resendVerificationCode`, `confirmSignup`, and `resetPassword` methods more versatile

Signed-off-by: Hans Kokx <hans.kokx@hackberry.se>
This commit is contained in:
Hans Kokx
2024-10-11 14:04:53 +02:00
parent a67e4adfa2
commit 9f00ed205b
5 changed files with 25 additions and 13 deletions
+12
View File
@@ -1,3 +1,15 @@
## 1.1.1
- [BREAKING] Updated ArcaneAuthInterface to make the `resendVerificationCode`, `confirmSignup`, and `resetPassword` methods more versatile
### Migration
| Class | Migration path |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| ArcaneAuthInterface | `resendVerificationCode(String email)` -> `resendVerificationCode<T>({T? input})` |
| ArcaneAuthInterface | `confirmSignup({String email, String password})` -> `confirmSignup({String? email, String? password})` |
| ArcaneAuthInterface | `resetPassword({String email, String? newPassword, String? code})` -> `resetPassword({String? email, String? newPassword, String? code})` |
## 1.1.0 ## 1.1.0
- [BREAKING] Updated the authentication service and interface to be more versatile - [BREAKING] Updated the authentication service and interface to be more versatile
@@ -53,8 +53,10 @@ class DebugAuthInterface implements ArcaneAuthInterface {
} }
@override @override
Future<Result<String, String>> resendVerificationCode(String email) async { Future<Result<String, String>> resendVerificationCode<T>({
Arcane.log("Re-sending verification code to $email"); T? input,
}) async {
Arcane.log("Re-sending verification code to $input");
return Result.ok("Code sent"); return Result.ok("Code sent");
} }
@@ -76,8 +78,8 @@ class DebugAuthInterface implements ArcaneAuthInterface {
@override @override
Future<Result<bool, String>> confirmSignup({ Future<Result<bool, String>> confirmSignup({
required String username, String? username,
required String confirmationCode, String? confirmationCode,
}) async { }) async {
Arcane.log( Arcane.log(
"Confirming registration for $username with code $confirmationCode", "Confirming registration for $username with code $confirmationCode",
@@ -87,7 +89,7 @@ class DebugAuthInterface implements ArcaneAuthInterface {
@override @override
Future<Result<bool, String>> resetPassword({ Future<Result<bool, String>> resetPassword({
required String email, String? email,
String? newPassword, String? newPassword,
String? code, String? code,
}) async { }) async {
@@ -60,9 +60,7 @@ abstract class ArcaneAuthInterface {
/// This method is typically used when the user hasn't received or has lost their initial /// This method is typically used when the user hasn't received or has lost their initial
/// verification code. Returns a `Result` that contains the verification code on success /// verification code. Returns a `Result` that contains the verification code on success
/// or an error message. /// or an error message.
Future<Result<String, String>>? resendVerificationCode( Future<Result<String, String>>? resendVerificationCode<T>({T? input});
String email,
);
/// Registers a new account using user-supplied input. /// Registers a new account using user-supplied input.
/// ///
@@ -83,8 +81,8 @@ abstract class ArcaneAuthInterface {
/// This method completes the sign-up process by verifying the user's confirmation code. /// This method completes the sign-up process by verifying the user's confirmation code.
/// Returns a `Result` that contains `true` on success or an error message. /// Returns a `Result` that contains `true` on success or an error message.
Future<Result<bool, String>>? confirmSignup({ Future<Result<bool, String>>? confirmSignup({
required String username, String? username,
required String confirmationCode, String? confirmationCode,
}); });
/// Resets a user's password using an email address and a code. /// Resets a user's password using an email address and a code.
@@ -98,7 +96,7 @@ abstract class ArcaneAuthInterface {
/// code or pin. The second call should include the `email`, the user's new password /// code or pin. The second call should include the `email`, the user's new password
/// (`newPassword`), and the `code` they received in their email. /// (`newPassword`), and the `code` they received in their email.
Future<Result<bool, String>>? resetPassword({ Future<Result<bool, String>>? resetPassword({
required String email, String? email,
String? newPassword, String? newPassword,
String? code, String? code,
}); });
@@ -252,7 +252,7 @@ class ArcaneAuthenticationService extends ArcaneService {
} }
final Future<Result<String, String>>? result = final Future<Result<String, String>>? result =
authInterface.resendVerificationCode(email); authInterface.resendVerificationCode(input: email);
if (result == null) { if (result == null) {
return Result.error( return Result.error(
+1 -1
View File
@@ -1,6 +1,6 @@
name: arcane_framework name: arcane_framework
description: "Agnostic Reusable Component Architecture for New Ecosystems: a modern framework for bootstrapping new applications" description: "Agnostic Reusable Component Architecture for New Ecosystems: a modern framework for bootstrapping new applications"
version: 1.1.0 version: 1.1.1
repository: https://github.com/hanskokx/arcane_framework repository: https://github.com/hanskokx/arcane_framework
issue_tracker: https://github.com/hanskokx/arcane_framework/issues issue_tracker: https://github.com/hanskokx/arcane_framework/issues