@@ -165,6 +165,12 @@ class SupaEmailAuth extends StatefulWidget {
165
165
/// If unspecified, the [redirectTo] value will be used.
166
166
final String ? resetPasswordRedirectTo;
167
167
168
+ /// Validator function for the password field
169
+ ///
170
+ /// If null, a default validator will be used that checks if
171
+ /// the password is at least 6 characters long.
172
+ final String ? Function (String ? )? passwordValidator;
173
+
168
174
/// Callback for the user to complete a sign in.
169
175
final void Function (AuthResponse response) onSignInComplete;
170
176
@@ -209,6 +215,7 @@ class SupaEmailAuth extends StatefulWidget {
209
215
super .key,
210
216
this .redirectTo,
211
217
this .resetPasswordRedirectTo,
218
+ this .passwordValidator,
212
219
required this .onSignInComplete,
213
220
required this .onSignUpComplete,
214
221
this .onPasswordResetEmailSent,
@@ -313,12 +320,13 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
313
320
textInputAction: widget.metadataFields != null && ! _isSigningIn
314
321
? TextInputAction .next
315
322
: TextInputAction .done,
316
- validator: (value) {
317
- if (value == null || value.isEmpty || value.length < 6 ) {
318
- return localization.passwordLengthError;
319
- }
320
- return null ;
321
- },
323
+ validator: widget.passwordValidator ??
324
+ (value) {
325
+ if (value == null || value.isEmpty || value.length < 6 ) {
326
+ return localization.passwordLengthError;
327
+ }
328
+ return null ;
329
+ },
322
330
decoration: InputDecoration (
323
331
prefixIcon: widget.prefixIconPassword,
324
332
label: Text (localization.enterPassword),
0 commit comments