@@ -80,34 +80,24 @@ class GigyaFlutterPluginWeb extends GigyaFlutterPluginPlatform {
80
80
String loginId, {
81
81
Map <String , dynamic > parameters = const < String , dynamic > {},
82
82
}) async {
83
- final String ? passwordResetToken = parameters['passwordResetToken' ] as String ? ;
84
- final String ? newPassword = parameters['newPassword' ] as String ? ;
85
-
86
- // Either login id or password reset token is required.
87
- if (loginId.isNotEmpty && passwordResetToken != null ) {
88
- throw ArgumentError ('Either loginId or passwordResetToken should be specified.' );
89
- }
90
-
91
- // If the password reset token is present, the new password should also be present.
92
- if (passwordResetToken != null && newPassword == null ) {
93
- throw ArgumentError .notNull ('newPassword' );
94
- }
95
-
96
- final ResetPasswordResponse response = gigyaWebSdk.accounts.resetPassword (
83
+ final JSAny ? response = GigyaWebSdk .instance.accounts.resetPassword.callAsFunction (
84
+ null ,
97
85
ResetPasswordParameters (
98
86
email: parameters['email' ] as String ? ,
99
- ignoreInterruptions: parameters['ignoreInterruptions' ] as bool ? ?? false ,
87
+ ignoreInterruptions: parameters['ignoreInterruptions' ] as bool ? ,
100
88
lang: parameters['lang' ] as String ? ,
101
89
// Treat an empty login id as null.
102
90
loginID: loginId.isEmpty ? null : loginId,
103
- newPassword: newPassword,
104
- passwordResetToken: passwordResetToken,
91
+ newPassword: parameters[ ' newPassword' ] as String ? ,
92
+ passwordResetToken: parameters[ ' passwordResetToken' ] as String ? ,
105
93
secretAnswer: parameters['secretAnswer' ] as String ? ,
106
94
securityFields: parameters['securityFields' ] as String ? ,
95
+ sendEmail: parameters['sendEmail' ] as bool ? ,
107
96
),
108
97
);
109
98
110
- return StaticInteropUtils .responseToMap (response);
99
+ // TODO: `callAsFunction` does not yet support generics.
100
+ return (response as ResetPasswordResponse ).toMap ();
111
101
}
112
102
113
103
@override
0 commit comments