@@ -165,6 +165,12 @@ class SupaEmailAuth extends StatefulWidget {
165165 /// If unspecified, the [redirectTo] value will be used.
166166 final String ? resetPasswordRedirectTo;
167167
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+
168174 /// Callback for the user to complete a sign in.
169175 final void Function (AuthResponse response) onSignInComplete;
170176
@@ -209,6 +215,7 @@ class SupaEmailAuth extends StatefulWidget {
209215 super .key,
210216 this .redirectTo,
211217 this .resetPasswordRedirectTo,
218+ this .passwordValidator,
212219 required this .onSignInComplete,
213220 required this .onSignUpComplete,
214221 this .onPasswordResetEmailSent,
@@ -313,12 +320,13 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
313320 textInputAction: widget.metadataFields != null && ! _isSigningIn
314321 ? TextInputAction .next
315322 : 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+ },
322330 decoration: InputDecoration (
323331 prefixIcon: widget.prefixIconPassword,
324332 label: Text (localization.enterPassword),
0 commit comments