feat: add password requirement display and enhance password validation on the signup page.
All checks were successful
Deploy Flutter to Firebase (Mac) / deploy-android (push) Successful in 2m40s
All checks were successful
Deploy Flutter to Firebase (Mac) / deploy-android (push) Successful in 2m40s
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:sign_in_button/sign_in_button.dart';
|
||||
import 'package:travel_mate/components/loading/laoding_content.dart';
|
||||
import 'package:travel_mate/components/signup/password_requirements.dart';
|
||||
import 'package:travel_mate/components/signup/sign_up_platform_content.dart';
|
||||
import 'package:travel_mate/services/auth_service.dart';
|
||||
import '../blocs/auth/auth_bloc.dart';
|
||||
@@ -66,6 +67,18 @@ class _SignUpPageState extends State<SignUpPage> {
|
||||
if (value.length < 8) {
|
||||
return 'Le mot de passe doit contenir au moins 8 caractères';
|
||||
}
|
||||
if (!value.contains(RegExp(r'[A-Z]'))) {
|
||||
return 'Le mot de passe doit contenir une majuscule';
|
||||
}
|
||||
if (!value.contains(RegExp(r'[a-z]'))) {
|
||||
return 'Le mot de passe doit contenir une minuscule';
|
||||
}
|
||||
if (!value.contains(RegExp(r'[0-9]'))) {
|
||||
return 'Le mot de passe doit contenir un chiffre';
|
||||
}
|
||||
if (!value.contains(RegExp(r'[!@#\$%^&*(),.?":{}|<>]'))) {
|
||||
return 'Le mot de passe doit contenir un caractère spécial';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -209,6 +222,7 @@ class _SignUpPageState extends State<SignUpPage> {
|
||||
controller: _passwordController,
|
||||
validator: _validatePassword,
|
||||
obscureText: _obscurePassword,
|
||||
onChanged: (value) => setState(() {}),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Mot de passe',
|
||||
border: const OutlineInputBorder(
|
||||
@@ -229,6 +243,7 @@ class _SignUpPageState extends State<SignUpPage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
PasswordRequirements(password: _passwordController.text),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Champ Confirmation mot de passe
|
||||
|
||||
Reference in New Issue
Block a user