Skip to content

Commit 33ae6e6

Browse files
committed
implement reset password response & interop method
1 parent c005eb9 commit 33ae6e6

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

lib/src/web/static_interop/account.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import 'parameters/account.dart';
55
import 'parameters/basic.dart';
66
import 'parameters/login.dart';
77
import 'parameters/registration.dart';
8+
import 'parameters/reset_password.dart';
9+
import 'response/reset_password_response.dart';
810

911
/// The extension type for the `gigya.accounts` JavaScript object.
1012
///
@@ -52,7 +54,13 @@ extension type Accounts(JSObject _) {
5254
///
5355
/// This function receives a [RegistrationParameters] instance as argument,
5456
/// and has [JSVoid] as return type.
55-
external JSFunction register;
57+
external JSFunction register;
58+
59+
/// Reset the user's password.
60+
///
61+
/// This function receives a [ResetPasswordParameters] instance as argument,
62+
/// and has [ResetPasswordResponse] as return type.
63+
external JSFunction resetPassword;
5664

5765
/// Get the `gigya.accounts.session` namespace.
5866
external Session get session;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import 'dart:js_interop';
2+
3+
import 'response.dart';
4+
5+
// TODO: fix the extension type
6+
// - String? time
7+
// - Emails? emails
8+
// - String? UID -> fix the JS annotation
9+
10+
/// The static interop class for the Gigya Reset Password API response.
11+
///
12+
/// See also: https://help.sap.com/docs/SAP_CUSTOMER_DATA_CLOUD/8b8d6fffe113457094a17701f63e3d6a/c21d4e0445b84a779af1ad4868902c21.html#response-data
13+
@JS()
14+
@anonymous
15+
@staticInterop
16+
class ResetPasswordResponse extends Response {}
17+
18+
/// This extension defines the static interop definition
19+
/// for the [ResetPasswordResponse] class.
20+
extension ResetPasswordResponseExtension on ResetPasswordResponse {
21+
@JS('emails')
22+
external Object? get _emails;
23+
24+
/// The email addresses belonging to the user.
25+
Map<String, dynamic> get emails {
26+
if (_emails.isUndefinedOrNull) {
27+
return const <String, dynamic>{};
28+
}
29+
30+
return (dartify(_emails) as Map<Object?, Object?>).cast<String, dynamic>();
31+
}
32+
33+
/// The token that should be used for the password reset in the password reset email.
34+
///
35+
/// This is null if the email is sent by the Gigya SDK.
36+
external String? get passwordResetToken;
37+
38+
/// The secret question for the password reset.
39+
///
40+
/// This is null if there is no security verification failure.
41+
external String? get secretQuestion;
42+
43+
/// The UID of the user whose password was changed.
44+
///
45+
/// This is null if the password was not changed yet.
46+
@JS('UID')
47+
external String? get uid;
48+
}

0 commit comments

Comments
 (0)